To have all logs transfered in the same way on linux dominating network here is a great tool:
https://code.google.com/p/eventlog-to-syslog/
Also accepts filtering using XPath expressions.
RTFM: https://eventlog-to-syslog.googlecode.com/files/Readme_4.5.0.pdf
сряда, 23 април 2014 г.
Regex web testers and tutorials/books
Inspired by regexbuddy. Works pretty fine and is web so can be used if you are away of your usual workplace and preffered software
Here is a handy guide: http://www.regular-expressions.info/quickstart.html
Still work in progress but since i like the author here is a "Learn the hard way" book on regex: http://regex.learncodethehardway.org/book/
Still work in progress but since i like the author here is a "Learn the hard way" book on regex: http://regex.learncodethehardway.org/book/
openssl Commands
Source: https://www.sslshopper.com/article-most-common-openssl-commands.html
Again copy/pasta to have it near when needed:
General OpenSSL Commands
These commands allow you to generate CSRs, Certificates, Private Keys and do other miscellaneous tasks.- Generate a new private key and Certificate Signing Request
openssl req -out CSR.csr -new -newkey rsa:2048 -nodes -keyout privateKey.key
- Generate a self-signed certificate (see How to Create and Install an Apache Self Signed Certificate for more info)
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout privateKey.key -out certificate.crt
- Generate a certificate signing request (CSR) for an existing private key
openssl req -out CSR.csr -key privateKey.key -new
- Generate a certificate signing request based on an existing certificate
openssl x509 -x509toreq -in certificate.crt -out CSR.csr -signkey privateKey.key
- Remove a passphrase from a private key
openssl rsa -in privateKey.pem -out newPrivateKey.pem
Checking Using OpenSSL
If you need to check the information within a Certificate, CSR or Private Key, use these commands. You can also check CSRs and check certificates using our online tools.- Check a Certificate Signing Request (CSR)
openssl req -text -noout -verify -in CSR.csr
- Check a private key
openssl rsa -in privateKey.key -check
- Check a certificate
openssl x509 -in certificate.crt -text -noout
- Check a PKCS#12 file (.pfx or .p12)
openssl pkcs12 -info -in keyStore.p12
Debugging Using OpenSSL
If you are receiving an error that the private doesn't match the certificate or that a certificate that you installed to a site is not trusted, try one of these commands. If you are trying to verify that an SSL certificate is installed correctly, be sure to check out the SSL Checker.- Check an MD5 hash of the public key to ensure that it matches with what is in a CSR or private key
openssl x509 -noout -modulus -in certificate.crt | openssl md5 openssl rsa -noout -modulus -in privateKey.key | openssl md5 openssl req -noout -modulus -in CSR.csr | openssl md5
- Check an SSL connection. All the certificates (including Intermediates) should be displayed
openssl s_client -connect www.paypal.com:443
Converting Using OpenSSL
These commands allow you to convert certificates and keys to different formats to make them compatible with specific types of servers or software. For example, you can convert a normal PEM file that would work with Apache to a PFX (PKCS#12) file and use it with Tomcat or IIS. Use our SSL Converter to convert certificates without messing with OpenSSL.- Convert a DER file (.crt .cer .der) to PEM
openssl x509 -inform der -in certificate.cer -out certificate.pem
- Convert a PEM file to DER
openssl x509 -outform der -in certificate.pem -out certificate.der
- Convert a PKCS#12 file (.pfx .p12) containing a private key and certificates to PEM
openssl pkcs12 -in keyStore.pfx -out keyStore.pem -nodes
You can add -nocerts to only output the private key or add -nokeys to only output the certificates. - Convert a PEM certificate file and a private key to PKCS#12 (.pfx .p12)
openssl pkcs12 -export -out certificate.pfx -inkey privateKey.key -in certificate.crt -certfile CACert.crt
Java Keystore commands
Source: http://www.sslshopper.com/article-most-common-java-keytool-keystore-commands.html
I will copy/pasta the part that i use so I will have it handy here.
Java Keytool Commands for Creating and Importing
These commands allow you to generate a new Java Keytool keystore file, create a CSR, and import certificates. Any root or intermediate certificates will need to be imported before importing the primary certificate for your domain.- Generate a Java keystore and key pair
keytool -genkey -alias mydomain -keyalg RSA -keystore keystore.jks -keysize 2048
- Generate a certificate signing request (CSR) for an existing Java keystore
keytool -certreq -alias mydomain -keystore keystore.jks -file mydomain.csr
- Import a root or intermediate CA certificate to an existing Java keystore
keytool -import -trustcacerts -alias root -file Thawte.crt -keystore keystore.jks
- Import a signed primary certificate to an existing Java keystore
keytool -import -trustcacerts -alias mydomain -file mydomain.crt -keystore keystore.jks
- Generate a keystore and self-signed certificate (see How to Create a Self Signed Certificate using Java Keytool for more info)
keytool -genkey -keyalg RSA -alias selfsigned -keystore keystore.jks -storepass password -validity 360 -keysize 2048
Java Keytool Commands for Checking
If you need to check the information within a certificate, or Java keystore, use these commands.- Check a stand-alone certificate
keytool -printcert -v -file mydomain.crt
- Check which certificates are in a Java keystore
keytool -list -v -keystore keystore.jks
- Check a particular keystore entry using an alias
keytool -list -v -keystore keystore.jks -alias mydomain
Other Java Keytool Commands
- Delete a certificate from a Java Keytool keystore
keytool -delete -alias mydomain -keystore keystore.jks
- Change a Java keystore password
keytool -storepasswd -new new_storepass -keystore keystore.jks
- Export a certificate from a keystore
keytool -export -alias mydomain -file mydomain.crt -keystore keystore.jks
- List Trusted CA Certs
keytool -list -v -keystore $JAVA_HOME/jre/lib/security/cacerts
- Import New CA into Trusted Certs
keytool -import -trustcacerts -file /path/to/ca/ca.pem -alias CA_ALIAS -keystore $JAVA_HOME/jre/lib/security/cacerts
вторник, 22 април 2014 г.
openssl verify
Make a folder to contain your public certificates:
#mkdir certs
#cd certs
Get public cert for the server you want to check:
#
Copy from the "-----BEGIN CERTIFICATE-----" to the "-----END CERTIFICATE-----" , and save it in a file ending in .pem
Get issuer (CA) root certificate ("Certification Authority Root Certificate")
should be provided by your issuer or if you are your own CA you should know how to get this. Place it in the same directory as the certificate of your server (the one you are testing).
Rehash the certificates. This is basically creating a link files to your .pem files. Names are based on the certificate content so openssl command will be able to operate on the files.
#for file in *.pem; do ln -s $file `openssl x509 -hash -noout -in $file`.0; done
Verify the certificate:
#openssl s_client -CApath . -connect server:port
Output should be similar to:
..
..
..
SSL-Session:
Protocol : TLSv1.2
Cipher : DES-CBC3-SHA
Session-ID: 53563D55F85CD643713643B7163A8C25113B114703C975DEA1C57D659FFBF96E
Session-ID-ctx:
Master-Key: 7288C083E0723BC61C4C21DC91908E34BD5C65695064E4E114FF4ED763ECA1D489794B9911E69021B8A8083A9CAB18EE
Key-Arg : None
Krb5 Principal: None
PSK identity: None
PSK identity hint: None
Start Time: 1398160725
Timeout : 300 (sec)
Verify return code: 0 (ok)
---
..
..
If you see Verify return code: 0 (ok) you are good!
#mkdir certs
#cd certs
Get public cert for the server you want to check:
#
openssl s_client -showcerts -connect server:port
Copy from the "-----BEGIN CERTIFICATE-----" to the "-----END CERTIFICATE-----" , and save it in a file ending in .pem
Get issuer (CA) root certificate ("Certification Authority Root Certificate")
should be provided by your issuer or if you are your own CA you should know how to get this. Place it in the same directory as the certificate of your server (the one you are testing).
Rehash the certificates. This is basically creating a link files to your .pem files. Names are based on the certificate content so openssl command will be able to operate on the files.
#for file in *.pem; do ln -s $file `openssl x509 -hash -noout -in $file`.0; done
Verify the certificate:
#openssl s_client -CApath . -connect server:port
Output should be similar to:
..
..
..
SSL-Session:
Protocol : TLSv1.2
Cipher : DES-CBC3-SHA
Session-ID: 53563D55F85CD643713643B7163A8C25113B114703C975DEA1C57D659FFBF96E
Session-ID-ctx:
Master-Key: 7288C083E0723BC61C4C21DC91908E34BD5C65695064E4E114FF4ED763ECA1D489794B9911E69021B8A8083A9CAB18EE
Key-Arg : None
Krb5 Principal: None
PSK identity: None
PSK identity hint: None
Start Time: 1398160725
Timeout : 300 (sec)
Verify return code: 0 (ok)
---
..
..
If you see Verify return code: 0 (ok) you are good!
понеделник, 10 март 2014 г.
AVD - Android Virtual Device - Scumbag Google
Преди време когато за пръв път тествах възможностите на емулатора включен в Android SDK-то, Google Store (по настоящем Google Play) присъстваше по подразбиране във всеки имидж който се предоставя за изтегляне от AVD-то. Сега? Сега мнението е, че правото да се използва магазина (особено за безплатните приложения) идва със закупуването на андроид устройство. Имиджите не включват "бялата торба". Отварянето на play.google.com и опита да се инсталира приложение от там води до неприятно съобщение че не сме използвали приложението (пак бялата торба) и съответно нямаме устройства добавени към акаунта въпреки че сме логнати със съответния акаунт в сайта.
Всичко това ме навежда на мисълта, че когато един производител създава устройство той си плаща на гугъл за правото да ползва андроид. Заедно с факта, че андроид е до голяма степен линук а това не се споменава официално никъде - започвам да си мисля дали парите "изкарани с пот на челата" ни, тези които даваме за да притежаваме и използваме умно устройство не са горивото за изграждане на една зла империя?
Струва си да споменем и постоянно присъстващия спам (реклами) в огромна част от приложенията.
Лично на мен започва да ми писва от тази политика която провеждат!
А сега към малко по-техническа част на тази тема.
Всичко това ме навежда на мисълта, че когато един производител създава устройство той си плаща на гугъл за правото да ползва андроид. Заедно с факта, че андроид е до голяма степен линук а това не се споменава официално никъде - започвам да си мисля дали парите "изкарани с пот на челата" ни, тези които даваме за да притежаваме и използваме умно устройство не са горивото за изграждане на една зла империя?
Струва си да споменем и постоянно присъстващия спам (реклами) в огромна част от приложенията.
Лично на мен започва да ми писва от тази политика която провеждат!
А сега към малко по-техническа част на тази тема.
Как да добавим бялата торба в имиджа на емулатора
Android 2.3 (защото това ми трябваше)
На налично устройство с андроид (телефона Ви например) инсталирайте стара версия на Astro File Explorer (новите които имат Cloud в името не вършат работа). От менюто изберете Tools-> Backup Application и изберете Google Store. За дестинация изберете SD картата. Това ще създаде apk файл vending.нещо.apk. Вземете този файл.
От /system/app/ вземете GoogleLoginServices.apk
Използвайте инструмент за едитване на Yaffs2 файлова система
- Няколко варианта: yaffs-tools, kernel support или лесния вариант, свалете Yaffey и го инсталирайте на някоя Windows машина. Според доста постове Yaffey чийто сорс е наличен и използва QT може да се компилира и под Линукс, но за мен беше по-лесно да ползвам Windows за да спестя малко време с това.
Отваряте system.img с Yaffey за системата която емулирате и под /system/app импортвате 2та apk файла. Запазвате имиджа и на следващия boot имате 'бяла торба' . Логвате се и щастливо си инсталирате приложения от стора.
General hints:
- Под Linux , AVD няма подръжка за Hardware
Execution Manager (HAXM).
Свалете си имидж за Intel Atom в AVD и инсталирайте libvirt с KVM. Добавете потребителя с който работите в съответните групи на libvirt и без допълнителни настройки емулатора в се ползва с хардуерна емулация. Работи супер бързо и мазно.
- Искате да снимате видео на Android 2.3 скрийна в емулатор. Няма приложение което да работи от самия Android.
Инсталирайте Аshot http://sourceforge.net/projects/ashot/
от него можете да снимате поредица от картинки и да ги свържете във видео. Решението е грозно, но за момента друго не съм намерил (под 2.3).
Същото нещо за Android 4.4 се прави с приложение което се намира на самия имидж но за това по-късно когато мога да го пробвам.
вторник, 5 ноември 2013 г.
TranSocks - Transparent SOCKSifying Proxy
За онези моменти когато имате sock прокси но нямате как да накарате flash плугина да работи с него има TranSocks
От сайта на приложението научих че линукс мрежовия филтър (iptables)
може да филтрува трафика в зависимост от потребителя и/или групата която го инициира - това вероятно е по-голямото откритие тъй като приложения като tranSocks има много.
От сайта на приложението научих че линукс мрежовия филтър (iptables)
може да филтрува трафика в зависимост от потребителя и/или групата която го инициира - това вероятно е по-голямото откритие тъй като приложения като tranSocks има много.
Абонамент за:
Публикации (Atom)