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
still recognice issue with os.geteuid() in Windows 10 21H1 #56
Comments
This issue was solved, please install the github version. |
OK, so the normal install-able version is not the github version? OK, let me try first. Then I need to update the README.md as well. python3-nmap: $ git clone https://github.com/wangoloj/python3-nmap.git $ pip3 install -r requirements.txt So, I guess git clone https://github.com/wangoloj/python3-nmap.git is not https://github.com/nmmapper/python3-nmap. I will check it now.... OK, when I check the version, it is still python-nmap3 version is: 1.4.9 udp scan is still not working (user is administrator): tcp-scan is working now.... File "C:\Users\mrene\Documents\PYTHON\ncurses-IPventur.py", line 418, in scannen portscan is working (as administrator).... stealth-scan same issue like fw scan (user is still admin): File "C:\Users\mrene\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\nmap3\utils.py", line 80, in wrapper arp-scan is working (as Admin).... I did the scan test always as Administrator: I will do test now with admin and none admin rights, just for Win10.... |
Alright I see a typo. change is_admin to is_root_or_admin Will fix and commit. If you can do it before me and make a pull request
|
So, I guess I have to change utils.py to this:
def user_is_root(func):
def wrapper(*args, **kwargs):
try:
is_root_or_admin = (os.getuid() == 0)
except AttributeError as e:
is_root_or_admin = ctypes.windll.shell32.IsUserAnAdmin() != 0
if(is_root_or_admin):
return func(*args, **kwargs)
else:
return {"error":True, "msg":"You must be root/administrator to continue!"}
return wrapper
correct?
Von: Nmmapper ***@***.***>
Gesendet: Sonntag, 15. August 2021 14:01
An: nmmapper/python3-nmap ***@***.***>
Cc: MrEnergy64 ***@***.***>; Author ***@***.***>
Betreff: Re: [nmmapper/python3-nmap] still recognice issue with os.geteuid() in Windows 10 21H1 (#56)
Alright I see a typo. change is_admin to is_root_or_admin Will fix and commit. If you can do it before me and make a pull request
try:
is_root_or_admin = (os.getuid() == 0)
except AttributeError as e:
is_admin = ctypes.windll.shell32.IsUserAnAdmin() != 0
if(is_root_or_admin):
return func(*args, **kwargs)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#56 (comment)> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/AN3CUBZFRMCMTMO46O2IFKLT46UBLANCNFSM5CFCEFJA> .
Triage notifications on the go with GitHub Mobile for iOS <https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android <https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email> . <https://github.com/notifications/beacon/AN3CUB3LO6B3FPMJI4TDWSTT46UBLA5CNFSM5CFCEFJKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOGWLEFJI.gif>
|
did pull request for utils.py |
We still identify the issue that your python3-nmap is using "os.geteuid()" which is not exist in Windows 10 (21H1) anymore:
File "C:\Users\mrene\Documents\PYTHON\ncurses-IPventur.py", line 389, in scannen
results = nmap.nmap_os_detection(f'{ip}')
File "C:\Users\mrene\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\nmap3\utils.py", line 74, in wrapper
if(os.geteuid() == 0):
AttributeError: module 'os' has no attribute 'geteuid'
Therefore actual you cannot do these scans under Windows 10:
nmap_detect_firewall
nmap_os_detection
nmap_stealth_scan
nmap.nmap_os_detection
In our python3-nmap front ncurses-IPventur we use this workaround with win32api.GetConsoleTitle(). Or do you have another solution instead of os.getuid? python-nmap3 version is: 1.4.9
os_version = platform.system()
if os_version == "Windows":
ScreenDel = "cls"
import win32api
check = win32api.GetConsoleTitle()
cmd = "where" if platform.system() == "Windows" else "which"
if "Administrator" in check:
User = "Administrator"
return os_version, User, ScreenDel, cmd
else:
User = "Normal User - limited scan"
return os_version, User, ScreenDel, cmd
else:
ScreenDel = "clear"
cmd = "where" if platform.system() == "Windows" else "which"
if os.geteuid()==0:
User = "Root User"
return os_version, User, ScreenDel, cmd
else:
User = "Normal User - limited scan"
return os_version, User, ScreenDel, cmd
The text was updated successfully, but these errors were encountered: