[ install ]
gangserver@NT200B5C-A22R:~$ sudo apt install python3-nmap
[sudo] gangserver 암호:
패키지 목록을 읽는 중입니다... 완료
의존성 트리를 만드는 중입니다... 완료
상태 정보를 읽는 중입니다... 완료
다음의 추가 패키지가 설치될 것입니다 :
liblinear4 libssh2-1t64 nmap nmap-common
제안하는 패키지:
liblinear-tools liblinear-dev ncat ndiff zenmap
다음 새 패키지를 설치할 것입니다:
liblinear4 libssh2-1t64 nmap nmap-common python3-nmap
0개 업그레이드, 5개 새로 설치, 0개 제거 및 5개 업그레이드 안 함.
6,068 k바이트 아카이브를 받아야 합니다.
이 작업 후 26.8 M바이트의 디스크 공간을 더 사용하게 됩니다.
계속 하시겠습니까? [Y/n] y
받기:1 http://kr.archive.ubuntu.com/ubuntu noble/universe amd64 nmap-common all 7.94+git20230807.3be01efb1+dfsg-3build2 [4,192 kB]
받기:2 http://kr.archive.ubuntu.com/ubuntu noble/universe amd64 liblinear4 amd64 2.3.0+dfsg-5build1 [42.3 kB]
받기:3 http://kr.archive.ubuntu.com/ubuntu noble/main amd64 libssh2-1t64 amd64 1.11.0-4.1build2 [120 kB]
받기:4 http://kr.archive.ubuntu.com/ubuntu noble/universe amd64 nmap amd64 7.94+git20230807.3be01efb1+dfsg-3build2 [1,694 kB]
받기:5 http://kr.archive.ubuntu.com/ubuntu noble/universe amd64 python3-nmap all 0.6.1-1.1 [20.1 kB]
내려받기 6,068 k바이트, 소요시간 3초 (1,873 k바이트/초)
Selecting previously unselected package nmap-common.
(데이터베이스 읽는중 ...현재 246170개의 파일과 디렉터리가 설치되어 있습니다.)
Preparing to unpack .../nmap-common_7.94+git20230807.3be01efb1+dfsg-3build2_all.
deb ...
Unpacking nmap-common (7.94+git20230807.3be01efb1+dfsg-3build2) ...
Selecting previously unselected package liblinear4:amd64.
Preparing to unpack .../liblinear4_2.3.0+dfsg-5build1_amd64.deb ...
Unpacking liblinear4:amd64 (2.3.0+dfsg-5build1) ...
Selecting previously unselected package libssh2-1t64:amd64.
Preparing to unpack .../libssh2-1t64_1.11.0-4.1build2_amd64.deb ...
Unpacking libssh2-1t64:amd64 (1.11.0-4.1build2) ...
Selecting previously unselected package nmap.
Preparing to unpack .../nmap_7.94+git20230807.3be01efb1+dfsg-3build2_amd64.deb .
..
Unpacking nmap (7.94+git20230807.3be01efb1+dfsg-3build2) ...
Selecting previously unselected package python3-nmap.
Preparing to unpack .../python3-nmap_0.6.1-1.1_all.deb ...
Unpacking python3-nmap (0.6.1-1.1) ...
liblinear4:amd64 (2.3.0+dfsg-5build1) 설정하는 중입니다 ...
nmap-common (7.94+git20230807.3be01efb1+dfsg-3build2) 설정하는 중입니다 ...
libssh2-1t64:amd64 (1.11.0-4.1build2) 설정하는 중입니다 ...
nmap (7.94+git20230807.3be01efb1+dfsg-3build2) 설정하는 중입니다 ...
python3-nmap (0.6.1-1.1) 설정하는 중입니다 ...
/usr/lib/python3/dist-packages/nmap/nmap.py:104: SyntaxWarning: invalid escape s
equence '\.'
'Nmap version [0-9]*\.[0-9]*[^ ]* \( http(|s)://.* \)'
/usr/lib/python3/dist-packages/nmap/nmap.py:141: SyntaxWarning: invalid escape s
equence '\.'
regex_subversion = re.compile('\.[0-9]+')
Processing triggers for man-db (2.12.0-4build2) ...
Processing triggers for libc-bin (2.39-0ubuntu8.2) ...
[ test ]
gangserver@NT200B5C-A22R:~$ python
Python 3.12.3 (main, Jul 31 2024, 17:43:48) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import nmap
>>> nm = nmap.PortScanner()
>>> nm.scan('127.0.0.1', '22-443')
{'nmap': {'command_line': 'nmap -oX - -p 22-443 -sV 127.0.0.1', 'scaninfo': {'tcp': {'method': 'connect', 'services': '22-443'}}, 'scanstats': {'timestr': 'Wed Aug 21 04:53:36 2024', 'elapsed': '0.23', 'uphosts': '1', 'downhosts': '0', 'totalhosts': '1'}}, 'scan': {'127.0.0.1': {'hostnames': [{'name': 'localhost', 'type': 'PTR'}], 'addresses': {'ipv4': '127.0.0.1'}, 'vendor': {}, 'status': {'state': 'up', 'reason': 'conn-refused'}}}}
>>> nm.command_line()
'nmap -oX - -p 22-443 -sV 127.0.0.1'
>>> nm.scaninfo()
{'tcp': {'method': 'connect', 'services': '22-443'}}
>>> nm.all_hosts()
['127.0.0.1']
>>> nm['127.0.0.1'].hostname()
'localhost'
>>> nm['127.0.0.1'].state()
'up'
>>> nm['127.0.0.1'].all_protocols()
[]
[ reference ]
https://xael.org/pages/python-nmap-en.html
'OS > Ubuntu' 카테고리의 다른 글
Ubuntu 24.04 python3-distutils-extra install (0) | 2024.08.21 |
---|---|
Ubuntu 24.04 python3-setuptools install (0) | 2024.08.21 |
Ubuntu 24.04 balena-etcher debian package(.deb) install error (0) | 2024.08.13 |
VMware Workstation Player 17.5.2 download (0) | 2024.07.21 |
Ubuntu 24.04 VMware Workstation Player 17.5.1 Install error (0) | 2024.07.21 |