6
2009
Raw Sockets C Source Code on Linux
The structure of IP Header as given by RFC 791 is : The structure of a TCP header as given by RFC 793 : To create a raw socket : Another option to make sure the kernel uses the raw headers : Below is an example code which constructs a raw TCP packet : Code : Remember to run the above code with root privileges. Raw sockets require root privileges User wireshark to check the [...]
3
2009
SYN Flood DOS Attack with C Source Code (Linux)
TCP/IP 3-way handshake is done to establish a connection between a client and a server. The process is : 1. Client –SYN Packet–> Server 2. Server –SYN/ACK Packet –> Client 3. Client –ACK Packet –> Server The above 3 steps are followed to establish a connection between source and destination. SYN Flood DOS attacks involves sending too many SYN packets (with a bad or random source ip) to the destination server. These SYN requests get [...]
2
2009
Top Games on Ubuntu Linux
So here is a list of games which can be played on Ubuntu. On Ubuntu 8.10 1. TORCS – The Open Racing Car Simulator – Racing game Install from Synaptic 2. Planet Penguin Racer – Racing Game Install from Synaptic 3. Extreme Tux Racer – Racing Game Install from Synaptic 4. Frozen Bubble – Puzzle Game Install from Synaptic 5. Supertuxkart – Racing Game Install from Synaptic 6. Alien Arena – 3D first person shooting [...]
2
2009
Get Country City from IP address in PHP
IPInfoDB provides a simple API to get the location of a visitor from his IP address. You need to first register and get an API Key. Then this code can be used : Code: IPinfodb supports json and xml formats for data output. The above code can be seen in action at ipmango.com. Another website GeoIO provides a similar API. You need to first register and get your code. Then you can code like this [...]
1
2009
Parse and Format Dates between PHP and Mysql
Mysql Database stores dates in the format : yyyy-mm-dd e.g. 2009-04-15 Whereas humans are more used to the formats like : dd-mm-yyyy or mm-dd-yyyy e.g. 21-04-2009 And while reading a format like : dd-Month-yyyy is more usable e.g. 21-Mar-2009 Checking a valid date : If the date is in format dd-mm-yyyy then a simple way to test its validity would be : But the above has an issue that it will report 31-02-2009 as a [...]
1
2009
PHP Database Class to access Mysql
This is a simple class that evolved out of the php code I wrote so far. It has the following functions : 1. dbms() – The constructor to do the initialisation like connecting to the database etc. 2. query($query) – The method to take a sql string and perform the query. 3. close() – Close the database connection 4. backup() – Create a backup of the database as an sql file and then zip it. [...]
1
2009
Restore Mysql Database from a sql or zip file using PHP
In the previous post we saw how the backup of a database can be taken in the form of a sql file and then zipped. In this example the same zip file would be used to restore the database from it. Code :
1
2009
Backup mysql database with php and zip it
PHP can be used to backup a mysql database and make a zip file of it. mysqldump is the utility which can be used to perform this function of backing up a mysql database as sql file. The command would be like this : mysqldump –user={$username} –password={$password} –quick –add-drop-table –add-locks –extended-insert –lock-tables –all {$db} > backups/backup.sql $username – mysql username $password – mysql password $db – name of the database to backup In the above [...]
Subscribe
Recent Posts
- Compile wxwebconnect on Ubuntu 11.04 64 bit
- Disqus Comments Importer Script in PHP
- Beginners’ guide to socket programming with winsock
- Handle multiple socket connections with fd_set and select on Linux
- Beginners guide to socket programming in C on Linux
- Gui whois client in python with wxpython
- Whois client code in C with Linux sockets
- str_replace for C
- Easy to use C/C++ IDE for Ubuntu Linux
- Get local ip in C on linux
An article by Binary Tides