python黑帽子
1.TCP客户端
#AF_INET 使用标准的IPv4地址或者主机名
#SOCK_STREAM是一个客户端
import socket target_host = 'www.google.com' target_port = 80 client = socket.socket(socket.AF_INET,socket.SOCKET_STREAM)
client.connect = ((target_host,target_port)) client.send('GET / HTTP/1.1\r\nHost:google.com\r\n\r\n') response = client.recv(4096) print response
2,TCP服务器
多线程TCP服务器
import socket
import threading bind_ip = '0.0.0.0'
bind_port = 9999 server = socket.socket(socket.AF_INET,socket.SOCK_STREAM) server.bind((bind_ip,bind_port)) server.listen(5) print 'TOTO:%s:%d' % (bind_ip,bind_port) def handle_client(client_socket)
request = client_socket,recv(1024)
print 'Received: %s' % request
client_socket.send('ACK')
client_socket.close() while True:
client,addr = server.accept()
print 'Accept from: %s:%d'%(addr[0],addr[1])
client_handler = threading.Thread(target=handle_client,args=(client,))
client_handler.start()
3.UTP客户端
import socket target_host = '127.0.0.1'
target_port = 80 cliect = socket.socket(socket,AF_INET,socket.SOCK_DGRAM) client = sendto('AAVVCC',(target_host,target_port)) data,addr = client.recvfrom(4096) print data
5.取代netcat
import sys
import socket
import getopt
import thrading
import subporcess #定义全局变量
listen = False
commanf = False
upload = False
execute = ""
target = ""
upload_destination = ""
port = 0 def usage():
print 'BHP Net Tool'
print "Usage:bhpnet.py -t target_host -p port"
print "-l --listen - listen on [host]:[port] for incoming connections"
print "-e --execute=file_to_run - execute the given file upon receiving a connection"
print " -c --command -initialize a commang shell"
print "-u --upload=destination - upon receiving connection upload a file and write to [destination]"
python黑帽子的更多相关文章
- 读书笔记 ~ Python黑帽子 黑客与渗透测试编程之道
Python黑帽子 黑客与渗透测试编程之道 <<< 持续更新中>>> 第一章: 设置python 环境 1.python软件包管理工具安装 root@star ...
- 2017-2018-2 20179204 PYTHON黑帽子 黑客与渗透测试编程之道
python代码见码云:20179204_gege 参考博客Python黑帽子--黑客与渗透测试编程之道.关于<Python黑帽子:黑客与渗透测试编程之道>的学习笔记 第2章 网络基础 t ...
- 《Python黑帽子》_1设置Python环境安装wingIDE
1首先你得有个Kali 检测python版本 安装pip 2安装wingIDE 网站 http://www.wingware.com 获取WingIDE 3解压wingide并且解决依赖关系 下载后在 ...
- 《Python黑帽子:黑客与渗透测试编程之道》 玩转浏览器
基于浏览器的中间人攻击: #coding=utf-8 import win32com.client import time import urlparse import urllib data_rec ...
- 《Python黑帽子:黑客与渗透测试编程之道》 Windows下木马的常用功能
有趣的键盘记录: 安装pyHook: http://nchc.dl.sourceforge.net/project/pyhook/pyhook/1.5.1/pyHook-1.5.1.win32-py2 ...
- 《Python黑帽子:黑客与渗透测试编程之道》 基于GitHub的命令和控制
GitHub账号设置: 这部分按书上来敲命令即可,当然首先要注册一个GitHub账号还有之前安装的GitHub API库(pip install github3.py),这里就只列一下命令吧: mkd ...
- 《Python黑帽子:黑客与渗透测试编程之道》 扩展Burp代理
下载jython,在Burpsuite的扩展中配置jython路径: Burp模糊测试: #!/usr/bin/python #coding=utf-8 # 导入三个类,其中IBurpExtender ...
- 《Python黑帽子:黑客与渗透测试编程之道》 Web攻击
Web的套接字函数库:urllib2 一开始以urllib2.py命名脚本,在Sublime Text中运行会出错,纠错后发现是重名了,改过来就好: #!/usr/bin/python #coding ...
- 《Python黑帽子:黑客与渗透测试编程之道》 Scapy:网络的掌控者
窃取email认证: 测试代码: #!/usr/bin/python #coding=utf-8 from scapy.all import * #数据包回调函数 def packet_callbac ...
- 《Python黑帽子:黑客与渗透测试编程之道》 网络:原始套接字和流量嗅探
Windows和Linux上的包嗅探: #!/usr/bin/python import socket import os #监听的主机 host = "10.10.10.160" ...
随机推荐
- [总结]数论和组合计数类数学相关(定理&证明&板子)
0 写在前面 0.0 前言 由于我太菜了,导致一些东西一学就忘,特开此文来记录下最让我头痛的数学相关问题. 一些引用的文字都注释了原文链接,若侵犯了您的权益,敬请告知:若文章中出现错误,也烦请告知. ...
- Go基础系列:函数(1)
Go中函数特性简介 对Go中的函数特性做一个总结.懂则看,不懂则算. Go中有3种函数:普通函数.匿名函数(没有名称的函数).方法(定义在struct上的函数). Go编译时不在乎函数的定义位置,但建 ...
- 翻译:用户变量(User-Defined Variable)(已提交到MariaDB官方手册)
本文为mariadb官方手册:User-Defined Variables的译文. 原文:https://mariadb.com/kb/en/user-defined-variables/我提交到Ma ...
- 第一册:lesson forty
原文: Penny's bag. A:Is that bag heavy,Penny? B:Not very. A:Here. Put it on this chair. What's in it? ...
- 【Java每日一题】20170302
20170301问题解析请点击今日问题下方的“[Java每日一题]20170302”查看(问题解析在公众号首发,公众号ID:weknow619) package Mar2017; public cla ...
- python中的魔法属性
目录 1. __doc__ 2. __module__ 和 __class__ 3. __init__ 4. __del__ 5. __call__ 6. __dict__ 7. __str__ 8. ...
- sourcetree Authentication failed
sourcetree 的 git 密码存在 mac 的 钥匙串里面, 需要在钥匙串里删除掉对应信息,再次打开就会让你重新输入密码, 问题就解决了。 参看: https://stackoverflow. ...
- A simple problem(湘大邀请赛)
A simple problem Accepted : 61 Submit : 418 Time Limit : 15000 MS Memory Limit : 655360 KB Probl ...
- Advanced redirection features
here are three types of I/O, which each have their own identifier, called a file descriptor: standar ...
- C#设计模式之十外观模式(Facade Pattern)【结构型】
一.引言 快12点半了,要开始今天的写作了.很快,转眼设计模式已经写了十个了,今天我们要讲[结构型]设计模式的第五个模式,该模式是[外观模式],英文名称是:Facade Pattern.我们先从名字上 ...