Python Forum
Trying to use python-nmap but receiving however python2 or 3 can't find PortScanner.
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Trying to use python-nmap but receiving however python2 or 3 can't find PortScanner.
#21
(Jan-19-2020, 07:09 PM)PythonNmap Wrote: ./ip-get.py
Try not run script like this as it can unclear if it run in Python 2 or 3.
Here for scratch in eg Kail,as my Mint 19 i use pyenv | tutorial then there is no python3 or pip3.
# Test python 3
root@kali-tom:~# python3 -V
Python 3.7.5
root@kali-tom:~# which python3
/usr/bin/python3

# Test pip3
root@kali-tom:~# pip3 -V
pip 18.1 from /usr/lib/python3/dist-packages/pip (python 3.7)

# Install
root@kali-tom:~# pip3 install python-nmap
Collecting python-nmap
Installing collected packages: python-nmap
Successfully installed python-nmap-0.6.1

# Test that it work
root@kali-tom:~# python3
Python 3.7.5 (default, Oct 27 2019, 15:43:29) 
[GCC 9.2.1 20191022] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import nmap
>>> 
>>> nmap.PortScanner
<class 'nmap.nmap.PortScanner'>

# No error it works.
>>> nmap.PortScanner()
<nmap.nmap.PortScanner object at 0x7ff42e2ca6d0>
>>> exit()
Now that all work can run script with python3 ip-get.py.
Reply
#22
Nice! That's handy! ( irt pyenv )

Never realized pip3 existed either. This is very helpful!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Listening on receiving Interface (using scapy) CodyTheCodeNoob 1 1,969 Dec-22-2024, 10:51 PM
Last Post: PolandoFaker
  Handling receiving updates from user in Telebot mohsenamiri 0 1,590 Aug-26-2024, 09:25 AM
Last Post: mohsenamiri
  Receiving this error in my "response" and causes script to return wrong status cubangt 18 5,746 Aug-13-2023, 12:16 AM
Last Post: cubangt
  SMA (simple moving avg) Not receiving Data (stock prices). gdbengo 2 2,201 Jul-31-2022, 08:20 PM
Last Post: paulyan
  Receiving snmp traps with more than one Community String ilknurg 0 3,875 Jan-19-2022, 09:02 AM
Last Post: ilknurg
  python2 python3 messed up : How to fix ? hary 15 11,682 Dec-30-2020, 08:26 PM
Last Post: hary
  using pudb on python2 code ErnestTBass 2 2,474 Aug-10-2020, 08:12 PM
Last Post: snippsat
  [Selenium]Timed out receiving message from renderer: 10.000 wood_6636 0 3,516 Jun-26-2020, 08:59 AM
Last Post: wood_6636
  output mismatching when porting a python from python2 env to python3 env prayuktibid 2 3,346 Jan-21-2020, 04:41 AM
Last Post: prayuktibid
  Receiving XML exception from nmap.scan() results. PythonNmap 4 5,318 Jan-21-2020, 04:41 AM
Last Post: PythonNmap

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020