Thursday, December 24, 2015

Adding new path to library search on Linux

If you want to a path (directory) to be looked into for a shared library, without adding it to LD_LIBRARY_PATH, then ad the path to /etc/ld.so.conf and run ldconfig

i.e
  1. Add directory to /etc/ld.so.conf
  2. run ldconfig

Monday, December 7, 2015

Remove password and merge PDF files in ubuntu

To remove password :

for file in *.pdf ; do qpdf --password=anil6053 --decrypt $file ./nopw/$fil
e; done


To merge pdf files,

pdftk *.pdf cat output mergedfile.pdf


If there are cases where some online tool has a limit on size of pdf file that it accepts, then the size of pdf can be reduced using the below command. You will of course loose some resolution...

Command to reduce the size of pdf :

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=smaller.pdf large.pdf

Friday, August 14, 2015

Extract layer 7 data from packet capture

If you want to extract the tcp payload of a set of packets (A tcp stream for example) Below command comes handy.

tshark -r test.pcap -2 -R"tcp.port==444" -T fields -e data  | tr -d '\n' | xxd -r -p > layer7_data

xxd converts ASCII hex to binary.