Code Monkey home page Code Monkey logo

Comments (4)

nmmapper avatar nmmapper commented on September 28, 2024 1

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.

santiago-mooser avatar santiago-mooser commented on September 28, 2024

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.

santiago-mooser avatar santiago-mooser commented on September 28, 2024

Ok, so I found an easy solution:

  1. 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

  1. 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.

nmmapper avatar nmmapper commented on September 28, 2024

Okay great solution.

from python3-nmap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.