Comments (4)
This is an interesting issue, i see your concern, unfortunately right now, there is no way of doing that in the script, but you can do something custom in your script as you wait for the solution on our part, I will surely find a way of doing it and update this issue.
from python3-nmap.
Here's a few solutions for elevating privileges with windows and linux if it helps.
I'll try cloning and branching to see whether I can get it working consistently on both linux and windows on Monday
from python3-nmap.
Ok, so I found an easy solution:
- Add a secondary default_comman(self) function called default_command_privileged(self) which will return
def default_command_privileged(self):
os_type = sys.platform
if os_type == 'win32':
# Elevate privileges and return nmap command
else:
cmd = "which nmap"
return self.default_args.format(nmap="sudo "+self.nmaptool, outarg="-oX")
#the sudo part of the command will ask for a password by itself
For windows UAC, you can implement this code to elevate privileges:
https://gist.github.com/sylvainpelissier/ff072a6759082590a4fe8f7e070a4952
- Make any scans that need sudo privileges (such as ICMP types or OS detections) use the default_command_privileged(self) instead
[optional] 3) add a module to run custom commands with privilege but without parsing
from python3-nmap.
Okay great solution.
from python3-nmap.
Related Issues (20)
- Capability to export reports as an argument HOT 4
- Monitoring the progress of the scans HOT 1
- bug - KeyError: 'enable_ipv6' when running NmapHostDiscovery().nmap_portscan_only(target='127.0.0.1') HOT 2
- Add `timeout` arg to scan commands
- Scanning for Custom Set of Ports Does not seem to work HOT 1
- ModuleNotFoundError: No module named 'nmapparser' HOT 2
- Removed possibility to elevate privileges in code (commit: 3c2246b7dfdd6164dd5b7a0a74cfdc6585ea5a32) HOT 5
- callback_progress HOT 2
- Version detection not running with Python3.10 HOT 4
- Can't tell when a request timed out HOT 2
- License classifier doesn't match LICENSE file HOT 1
- max port variable error HOT 2
- Unable to parse xml output HOT 8
- Arguments for dns_brute_script HOT 3
- Shell stdout breaks when using nmap_list_scan on multiple addresses asynchronously HOT 1
- async option is missing HOT 1
- Inconsistent Port Status Results with Python Nmap HOT 1
- Can't exclude a script(s) HOT 1
- Max port 65389 ? HOT 3
- ModuleNotFoundError: No module named 'nmapparser', 'nmap3', 'nmap' HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python3-nmap.