Beispiel #1
0
def sendShoutbox(msg: str, apitoken: str) -> str:
    response = rawPostSSL("/shouts/new/", f"text={msg}", apitoken,
                          "x-www-form-urlencoded", "")
    if '"success":"1"'.encode() in response:
        return "success"
    else:
        return "failed"
Beispiel #2
0
def enviar_mensaje_shout():
    try:
        msg = input("\n\t[+] Escribe el mensaje que quieras enviar >>")
        response = rawPostSSL("/shouts/new/", f"text={msg}", API,
                              "x-www-form-urlencoded", "")
        print(Fore.GREEN + "[+] Mensaje enviado" + Fore.RESET)
    except Exception as e:
        print(Fore.RED + "Error: %s" % (e) + Fore.RESET)
Beispiel #3
0
def getShoutboxLatest(apitoken: str) -> dict:
    response = rawPostSSL(f"/shouts/get/initial/html/1", "", apitoken, "",
                          "}").decode()
    if '"success":"0"' in response:
        return "failed"
    response = response[response.find('{"success":"1"'):]
    jsondata = json.loads(response)
    return jsondata
Beispiel #4
0
def startConversation(msg: str, recipient: str, apitoken: str) -> str:
    response = rawPostSSL("/conversations/new/",
                          f"recipients%5B%5D={recipient}&message={msg}",
                          apitoken, "x-www-form-urlencoded", "")
    if "No valid recipients selected".encode() in response:
        return "invalid_recipient"
    elif '{"id":'.encode() in response:
        return "success"
    else:
        return "failed"
Beispiel #5
0
def inicia_conversacion(destinatario):
    try:
        msg = input("\n\t[+] Escribe el mensaje que quieras enviar >>")
        response = rawPostSSL(
            "/conversations/new/",
            f"recipients%5B%5D={destinatario}&message={msg}", API,
            "x-www-form-urlencoded", "")
        print(Fore.GREEN + "[+] Mensaje enviado" + Fore.RESET)
    except Exception as e:
        print(Fore.RED + "Error: %s" % (e) + Fore.RESET)
Beispiel #6
0
def conversacion_iniciada():
    try:
        response = rawPostSSL("/conversations/list/", "", API, "",
                              '"}]').decode()
        response = response[response.find('[{"id":'):]
        jsondata = json.loads(response)
        for i in jsondata:
            print(Fore.YELLOW + "\n\t\t%s: %s -> %s" %
                  (i['id'], i['usernames'], i['lastmessage']) + Fore.RESET)

        conversationid = int(input("\n\t[+]Ingresa el 'ID' del usuario>> "))
        msg = input("\n\t[+] Escribe el mensaje que quieras enviar >>")

        response = rawPostSSL(f"/conversations/send/{conversationid}/",
                              f"id={conversationid}&message={msg}", API,
                              "x-www-form-urlencoded", "")
        print(Fore.GREEN + "[+] Mensaje enviado" + Fore.RESET)
    except Exception as e:
        print(Fore.RED + "Error: %s" % (e) + Fore.RESET)
Beispiel #7
0
def todas_conversaciones():
    try:
        response = rawPostSSL("/conversations/list/", "", API, "",
                              '"}]').decode()
        response = response[response.find('[{"id":'):]
        jsondata = json.loads(response)
        for i in jsondata:
            print(Fore.YELLOW + "\n\t\t%s: %s -> %s" %
                  (i['id'], i['usernames'], i['lastmessage']) + Fore.RESET)
    except Exception as e:
        print(Fore.RED + "Error: %s" % (e) + Fore.RESET)
Beispiel #8
0
 def extendMachine(machineid: int, apitoken: str) -> str:
     response = rawPostSSL(f"/vm/vip/extend/{machineid}", "", apitoken, "",
                           "")
     if "Machine not assigned to this lab.".encode() in response:
         return "machine_not_active"
     elif "Machine extended by 24 hours.".encode() in response:
         return "success"
     elif "Incorrect lab type.".encode() in response:
         return "no_vip"
     else:
         return "failed"
Beispiel #9
0
 def stopMachine(machineid: int, apitoken: str) -> str:
     response = rawPostSSL(f"/vm/vip/remove/{machineid}", "", apitoken, "",
                           "")
     if "Machine scheduled for termination.".encode() in response:
         return "success"
     elif "This machine is not active.".encode() in response:
         return "machine_not_active"
     elif "Incorrect lab type.".encode() in response:
         return "no_vip"
     else:
         return "failed"
Beispiel #10
0
 def assignMachine(machineid: int, apitoken: str) -> str:
     response = rawPostSSL(f"/vm/vip/assign/{machineid}", "", apitoken, "",
                           "")
     if "Machine deployed to lab.".encode() in response:
         return "success"
     elif "You already have an active machine.".encode() in response:
         return "already_have_machine"
     elif "Incorrect lab type.".encode() in response:
         return "no_vip"
     else:
         return "failed"
Beispiel #11
0
    def ownChallenge(challengeid: int, apitoken: str, flag: str, difficulty: int) -> str:
        response =  rawPostSSL("/challenges/own/", f'challenge_id={challengeid}&flag={flag}&difficulty={difficulty * 10}', apitoken, "x-www-form-urlencoded", "")
        if '"success":"1"'.encode() in response:
            return "success"
        elif "Incorrect flag".encode() in response:
            return "flag_invalid"
        else:
            return "failed"

    # def getAllChallenges(apitoken):
    # cant seem to find challenge listing... web scraping?
Beispiel #12
0
 def ownRoot(machineid: int, apitoken: str, flag: str,
             difficulty: int) -> str:
     response = rawPostSSL(
         f"/machines/own/root/{machineid}",
         f'{{"flag":"{flag}","difficulty":{difficulty * 10}}}', apitoken,
         "json", "")
     if '"success":"1"'.encode() in response:
         return "success"
     elif "Incorrect hash".encode() in response:
         return "flag_invalid"
     else:
         return "failed"
Beispiel #13
0
def sendConversationMessage(msg: str, conversationid: int,
                            apitoken: str) -> str:
    response = rawPostSSL(f"/conversations/send/{conversationid}/",
                          f"id={conversationid}&message={msg}", apitoken,
                          "x-www-form-urlencoded", "")
    # if you type an invalid id you for some reason get the skid message...
    if "You must have Script Kiddie rank or higher to send messages".encode(
    ) in response:
        return "no_skid_or_invalid_id"
    # could be a non-success, but we cant confirm so here we go...
    elif "HTTP/1.1 200".encode() in response:
        return "success"
    else:
        return "failed"
Beispiel #14
0
def comprobar_flag(flag):
    try:
        #MODIFICAR
        #MODIFICAR
        #MODIFICAR
        response = rawPostSSL(
            "/challenges/own/",
            f'challenge_id={challengeid}&flag={flag}&difficulty={difficulty * 10}',
            API, "x-www-form-urlencoded", "")
        if '"success":"1"'.encode() in response:
            return "success"
        elif "Incorrect flag".encode() in response:
            return "flag_invalid"
        else:
            return "failed"
    except Exception as e:
        print(Fore.RED + "Error: %s" % (e) + Fore.RESET)
Beispiel #15
0
def mostrar_ultimo_mensaje():
    try:
        response = rawPostSSL(f"/shouts/get/initial/html/1", "", API, "",
                              "}").decode()
        if '"success":"0"' in response:
            return "failed"
        response = response[response.find('{"success":"1"'):]
        bs = BeautifulSoup(response, "lxml")
        ref = bs.find_all('a')
        span = bs.find_all('span')
        for r in ref:
            print(r.contents[0])

        for i in span:
            print(i.contents[0])

    except Exception as e:
        print(Fore.RED + "Error: %s" % (e) + Fore.RESET)
Beispiel #16
0
def getConversation(conversationid: int, apitoken: str) -> list:
    response = rawPostSSL(f"/conversations/load/{conversationid}", "",
                          apitoken, "", "}]\r\n").decode()
    response = response[response.find('[{"id":'):]
    jsondata = json.loads(response)
    return jsondata
Beispiel #17
0
def getConversations(apitoken: str) -> list:
    response = rawPostSSL("/conversations/list/", "", apitoken, "",
                          '"}]').decode()
    response = response[response.find('[{"id":'):]
    jsondata = json.loads(response)
    return jsondata
Beispiel #18
0
 def resetMachine(machineid: int, apitoken: str) -> str:
     response = rawPostSSL(f"/vm/reset/{machineid}", "", apitoken, "", "")
     if "requested a reset on".encode() in response:
         return "success"
     else:
         return "failed"