Monday, March 30, 2015

twitter bulk unfollow

Open "Following" page on Twitter and scroll down to have all following accounts showed in the browser.
Next run the following JavaScript code in your development console:
$('.button-text.unfollow-text').trigger('click');

http://www.quora.com/How-can-you-unfollow-everyone-on-Twitter-at-once

Tuesday, September 23, 2014

Command for computing max number of requests per second

 cat access_log.2014-09-23.txt | awk '{print $4}' | sort | uniq -c | sort -n

(assuming $4 is the timestamp)

per hour (sorted on hour):
cat access_log.2015-02-08.txt | awk '{print substr($4,14,2)}' | sort | uniq -c | sort -n -k2

List of IPs with number of requests in a particular hour(15) :
 cat access_log.2015-03-09.txt | awk '{if('15' == substr($4,14,2)) print $1}' | sort | uniq -c | sort -n

Saturday, June 28, 2014

Notes from Violent Python

1. The European Network and Information Security Agency provides an excellent resource for analyzing network traffic. They provide a live DVD ISO image that contains several network captures and exercises. You can download a copy from http://www.enisa.europa.eu/activities/cert/support/exercise/live-dvd-iso-images. 

2. NMap can be used in python via a library.

3. Pexpect(python) can be used for automating interactive applications - for e.g.   

4. ftplib for brute force ftp user credentials.

5. Metasploit as a penetration testing tool.

6. wigle.net for finding lat/long for a wifi router   

Sunday, June 22, 2014

Python simple script to connect to a host/port and get response.

__author__ = 'admin'
import socket
s = socket.socket()
s.settimeout(3)
s.connect(("server.com",21))
ans  = s.recv(1024)
print ans

Thursday, June 19, 2014

MySql db restore from dump failing

Solution : increase max_allowed_packet

Details :
Recently, I had a strange problem. While doing source dbdump.sql (dbdump.sql was generated by mysqldump) - initial data was loaded fine but after a while data was not being restored properly due to foreign key checks failing.

The dump file was disabling foreign key checks at the top and enabling again at the bottom  - so it was highly surprising.

To debug this I wrote a php script which executed queries line by line from the dump. I observed that it failed at a query where the data being inserted was huge which made database connection go away. And when it came back the foreign key check was enabled again - which in turn made a lot of things fail.

So I increased max_allowed_packet to 64M in my.ini and restarted mysql server. Solved.

Blog Archive