**Hidden Content: To see this hidden content your post count must be 20 or greater.**
**Hidden Content: To see this hidden content your post count must be 20 or greater.**
อันนี้ผมไปค้นบทความเรื่องเกี่ยวกับ airodump-ng มา เลยนำมาฝากครับผม
เป็นการใช้ airodump เก็บข้อมูลลงใน MySQL
[hide=20]โค๊ดแปลงให้ airodump-ng เก็บข้อมูลลง MySQL
April 7th, 2009
บันทึกการปรับแต่งให้ airodump-ng เก็บข้อมูลลงฐานข้อมูล โปรแกรมที่แก้ไขนี้ เป็นการแก้ไขโค๊ตให้โปรแกรม airodump-ng สามารถเพิ่มข้อมูลลงฐานข้อมูลโดยตรง โดยที่ไม่ได้เข้าไปอ่านไฟล์ text แล้วแปลง ที่มาของโครงการนี้เกิดจากการพัฒนาระบบตรวจจับและตอบโต้แอกเซสพอยต์เถื่อน ที่ใช้งานแอกเซสพอยต์ซิสโก้เพื่อให้ดักจับข้อมูลในอากาศแล้วส่งกลับมายังเครื่องแม่ข่ายเพื่อบันทึกลงฐานข้อมูล(MySQL) แต่คราวนี้ ต้องการให้ระบบนี้สามารถใช้งานร่วมกับ โปรแกรม sniffer ยี่ห้ออื่นได้ ก็เลยเริ่มต้นที่ airodump-ng ก่อน หากต้องการทำความเข้าใจ source code ขอบอกว่า ไม่มีอะไรยาก เพียงแต่เคยเขียนภาษา C ให้ติดต่อกับ MySQL ได้ ก็จะเข้าใจ เพราะเป็นเพียงการอ่านข้อมูลไปเก็บลงฐานข้อมูล ตัวอย่าง source code มีดังนี้
และเมื่อจะนำไปใช้งาน ให้แก้ไขไฟล์ airodump-ng.c แล้วให้เรียกฟังก์ชั่นด้านบน ด้วยคำสั่งต่อไปนี้Code:int air2db(struct AP_info *cur_ap){ struct AP_info *ap; MYSQL *conn; char *sql_server = “localhost”; char *sql_username = “root”; char *sql_password = “YouRsecRet”; char *sql_database = “ryg”; conn = mysql_init(NULL); ap=cur_ap; if (!mysql_real_connect(conn, sql_server, sql_username, sql_password, sql_database, 0, NULL, 0)) { fprintf(stderr, “%s\n”, mysql_error(conn)); exit(0); } char sql[1024*100]; sprintf(sql,”INSERT INTO ap_info (id,bssid) VALUES (,’%02X%02X%02X%02X%02X%02X’);”,ap->bssid[0],ap->bssid[1],ap->bssid[2],ap->bssid[3],ap->bssid[4],ap->bssid[5]); if (mysql_query(conn,sql)) { fprintf(stderr, “%s\n”, mysql_error(conn)); exit(0); } mysql_close(conn); return(0); }
[code]air2db(ap_cur);
write_packet:
if(ap_cur != NULL)
{
if( h80211[0] == 0
Actions : (View-Readers)
There are no names to display.