이 형식의 배너 목록이 있습니다.
Hostname: []
IP: xxx.xxx.xxx.xxx
Port: xx
HTTP/1.0 301 Moved Permanently
Location: /login.html
Content-Type: text/html
Device-Access-Level: 255
Content-Length: 3066
Cache-Control: max-age=7200, must-revalidate
IP를 확보하기 위해 다음 grep 문을 사용했습니다.
grep -E -o "([0-9]{1,3}[\.]){3}[0-9]{1,3}"
항구를 잡으려면 성명서에 무엇을 추가해야합니까? (여전히 IP를 얻는 동안.).
답변 감사합니다 ..!
사용하지 않는 이유 awk
awk '/IP:/ {ip=$2} /Port:/ {print ip,$2}' file
그것과 함께 줄을 찾으면 IP:
IP를 변수에 저장합니다 . 포트를 ip
찾으면 인쇄 ip
하고 포트 번호를 인쇄 합니다.
예
cat file
Hostname: []
IP: 163.248.1.20
Port: 843
HTTP/1.0 301 Moved Permanently
Location: /login.html
Content-Type: text/html
Device-Access-Level: 255
Content-Length: 3066
Cache-Control: max-age=7200, must-revalidat
awk '/IP:/ {ip=$2} /Port:/ {print ip,$2}' file
163.248.1.20 843
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다