Useful commands

Here i share some useful command which may make your shell task easy... I run this command on ubantu os. 


The command to convert hex string of certificate to pem file

1) Store the Hex String of in file named cert.txt 2) Run following command
cat cert.txt | xxd -r -p | openssl x509 -inform DER -out mycert.pem -outform PEM Cert to PEM 3) openssl x509 -outform DER -in ayush.pem -out ayush.crt

Which is better ?? encrypt then mac or mac then encrypt
Your answer is here

https://crypto.stackexchange.com/questions/202/should-we-mac-then-encrypt-or-encrypt-then-mac

 Adb Push Command
 
To push a file in mobile device using android sdk tool named adb(you can find it in android-sdk/platform-tools)

./adb push /home/ayush/apk.zip /sdcard/Android/Ask/

Adb Pull Command

To full a file from mobile device

./adb pull /sdcard/Android/124.apk /home/ayush

Sigining a apk after changes

1) First deleting *.SF, *.DSA, *.RSA files from the apk's META-INF and then signing the jar again.

2)Then Generate a Key Pair
keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000

3) Export jdk

4) Sign the apk using jarsigner(in jdk)

jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore /home/ayush/Testing/ayush.apk alias_name

5) Verify it using jarsigner

jarsigner -verify -verbose -certs /home/ayush/ayush.apk


OpenSsl:-

1) openssl s_client -connect 192.168.10.100:8443

Query to find the current working Queries and processes on oracle.

SELECT sess.process, sess.status, sess.username, sess.schemaname, sql.sql_text FROM v$session sess, v$sql sql WHERE sql.sql_id(+) = sess.sql_id AND sess.type = 'USER'


Send zip using nc command

SERVER(on recieving end)

nc -l 1234 -q 1 > something.zip < /dev/null

CLIENT (on sending end)

cat cms_serv.jar | netcat localhost 1234



Author
Ayush khandelwal