Skip to content

Large number of cookies exceeding the defined buffer size can crash the script #17

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

Open
wants to merge 3 commits 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
16 changes: 11 additions & 5 deletions jsh.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#!/usr/bin/env python3
import socket
import sys
from requests import get
import argparse

from requests import get


red = '\033[1;31m'
white = '\033[1;m'
Expand Down Expand Up @@ -37,7 +38,6 @@
parser.add_argument('-w', help='timeout for shell connection', dest='secs', type=float, default=0)
parser.add_argument('-q', help='quiet mode', dest='quiet', action='store_true')


args = parser.parse_args()

host = args.host
Expand Down Expand Up @@ -174,14 +174,20 @@ def main():

try:
c, addr = s.accept()
resp = c.recv(1024).decode()
resp = ""
while True:
b = c.recv(1024).decode()
if not b:
break
resp += b
except KeyboardInterrupt:
if sys.platform == 'win32':
print('\nControl-C')
exit()
except:
except(e):
print(e)
s.close()
main()


if 'Accept' in resp and 'HTTP' in resp:
print('Got JS shell from [%s] port %s to %s %s' % (addr[0], addr[1], socket.gethostname(), port))
Expand Down