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.

Friday, April 12, 2013

Get openerp working from source

  • Run openerp from source
    • Download source using bazaar
      • Install bazaar
      • Configure bazaar for launchpad repository
      • download(branch) source
    • Get the server running from source
      After getting the sourced using bzr, run openerp-server.py
    • Get the web client running from source
      install python-cherrypy python-formencode This error can be seen at the core (server): [2013-04-11 16:00:31,280][template1] ERROR:db.connection_pool:Connection to the database failed Traceback (most recent call last): File "/home/advaith/openerp/bzr/openerp/server/bin/sql_db.py", line 303, in borrow result = psycopg2.connect(dsn=dsn, connection_factory=PsycoConnection) File "/usr/lib/python2.7/dist-packages/psycopg2/__init__.py", line 179, in connect connection_factory=connection_factory, async=async) OperationalError: FATAL: role "advaith" does not exist
    • Get GTK Client running from source.
      ./configure make make install /usr/local/bin/openerp-client
    • Install and configure postgresql for openerp
      Follow steps from this link : http://doc.openerp.com/v6.1/install/linux/postgres/index.html The links talks about creating role openerp. But I created role 'advaith' as suggested in error message
    • Once postgresql is installed and configured,you can access create database.

Friday, February 8, 2013

Share files using remote desktop

You can share a folder on the client machine so that it's available for read and write on the server to which you do remote desktop.

use the -r option of rdesktop.

rdesktop 172.16.229.23 -r disk:share=/tmp

On remote machine, you can see an new drive with name 'share on '. You can read/write files from the drive.

Wednesday, June 29, 2011

Test HTTPS sites using openssl

We often use telnet to connect to a web server and test it.
But telnet cannot be used when the site is HTTPS (SSL).
openssl command can be used to do this.

For example:
openssl s_client -connect encrypted.google.com:443

-quiet can be used if you want the connection to be closed once done. This is useful when you use this within scripts.

Below command can be used in a script:

 openssl s_client -tls1 -ign_eof -connect 10.102.34.122:443 <GET /
EOFH

Wednesday, December 23, 2009

shell script to download youtube video

Here is a shell script that I wrote to download youtube video (given the video URL)

This is based on youtube-dl (that's in python) tool that is available in ubuntu software repository.

I came to know that across the globe use my tool. The get in touch whenever it stops working.

Thursday, July 16, 2009

How to generate and examine windows core dumps

How to generate and examine windows core dumps

Look at help-->contents (.chm) for detailed reference

You will not be able to see symbols in the dump file if you don't have the symbol database (.pdb) file for your application. The /Z7 option that puts the symbol information in the .obj files did not help.

gotcha : when /Zi option is used and code compiled through ssh session, the com,piler fails. Running the build through windows command prompt works !


I had to compile the product with /Zi (for cl.exe) option that created vc80.pdb file.
Then during linking, use /DEBUG /PDB:/path/to/.pdb . The .pdb file generated in the link step can be used with windbg

reference:
http://msdn.microsoft.com/en-us/library/yd4f8bd1%28v=vs.71%29.aspx
http://msdn.microsoft.com/en-us/library/yd4f8bd1.aspx

you can also extract pdb from an executable that is compiled with /Z7 option (as documented here) . did not work for me though
http://support.microsoft.com/kb/258205