![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python小脚本
练练手
JF Sec
这个作者很懒,什么都没留下…
展开
-
python模拟NC
服务器#服务端,放在本地import socketsock = socket.socket(socket.AF_INET,socket.SOCK_STREAM)sock.bind(("127.0.0.1",8888))sock.listen(3)conn,addr = sock.accept()#等待对方连我while True: cmd = input("输入$:") conn.send(cmd.encode()) msg = conn.recv(1024)原创 2021-02-24 22:43:10 · 358 阅读 · 0 评论 -
python编写子域名挖掘工具
import requestsimport reimport threadingfrom urllib.parse import urlencode#查询子域名def scan_domain(domain,page):#域名,页数 sub_domains = [] url = "搜索语法" header={ "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (原创 2021-02-28 16:05:52 · 698 阅读 · 1 评论 -
python网络编程入门
服务端#tcp服务端import socketimport threading#创建连接def data_recv(conn): while True: msg = conn.recv(1024)#接收客户端的信息 print("输出:" + msg.decode())def msg_send(conn): while True: data = input("输入:") conn.send(data.encode()原创 2021-02-24 22:36:55 · 117 阅读 · 0 评论 -
python线程共享
#线程共享import threadingnum = list(range(1000))def set(num,lock): lock.acquire() for i in num[-1:0:-1]: num[i] = 0 lock.release()def test(num,lock): lock.acquire() for i in num: print(i) lock.release()if __name_原创 2021-02-24 21:56:02 · 117 阅读 · 0 评论 -
python之popen函数入门案例
#执行命令import osmsg = os.popen("ipconfig")msg2 = os.popen("ping 127.0.0.1")for i in msg: print(i.strip())#去除空格for m in msg2: print(m.strip())原创 2021-02-24 22:40:15 · 182 阅读 · 0 评论 -
python编写数据库爆破工具
"""数据库爆破"""import pymysqlff = open("dic/user.txt",'r')user = ff.readline().strip()while user: with open("dic/password.txt",'r') as f: password = f.readline().strip() while password: try: conn = pymysql原创 2021-02-28 16:27:27 · 668 阅读 · 3 评论 -
python子域名爆破工具
""""二、子域名爆破通过暴力破解来获得子域名,类似子域名挖掘机的功能"""import requestsfrom concurrent.futures import ThreadPoolExecutordef pj(domain): with open('dic/text.txt','r') as f: key = f.readline().strip() while key: url = "http://"+key+"."+原创 2021-02-28 16:07:57 · 700 阅读 · 0 评论 -
python编写主机发现工具(ICMP)
"""scapy发送icmp包,进行主机发现 ping"""from scapy.all import *from optparse import OptionParserfrom concurrent.futures import ThreadPoolExecutordef scan_host(ip): pkt = IP()/ICMP(seq=2000)/b'hello world' pkt['IP'].dst = ip results = sr1(pkt,timeo原创 2021-02-28 16:36:15 · 851 阅读 · 2 评论 -
python爬虫入门
import requestsimport re#数据爬取url = "爬取页面"header = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36"}response = requests.get(url,headers = header)print(response.s原创 2021-02-28 15:31:42 · 202 阅读 · 2 评论 -
python编写端口扫描工具
"""端口扫描"""import socketfrom optparse import OptionParserfrom concurrent.futures import ThreadPoolExecutor# ip = "192.168.10.238"# port = 445def scan_one(ip,port): socket.setdefaulttimeout(1) try: sock = socket.socket(socket.AF_INET,原创 2021-02-28 16:32:15 · 254 阅读 · 1 评论 -
python爬取图片
一、爬取一张图片二、爬取一页图片三、爬取整个网站图片(封装写法)原创 2021-02-28 15:45:44 · 348 阅读 · 1 评论