#1 16 May 2017 20:51

msalman
Member
Registered: 02 Nov 2012
Posts: 9

how clean up port scan output txt result

hello brothers i want two bat codes one for ip with port like
127.0.0.1:80

and one for just ip
127.0.0.1

out of this scan result

#masscan
open tcp 80 127.0.0.1 1494962279
# end

i have tested this code

@echo off
cls
color b
title aa
for /f "eol=- tokens=1,2 delims= " %%A in ('type result.txt ^|find ^".^"') do (
 IF [%%A] NEQ [Scan] (
  echo %%A:%%B>>list.txt
 )
)

but it gives me this result

open:tcp
open:tcp

Last edited by msalman (16 May 2017 20:51)

Offline

#2 17 May 2017 04:49

Shadow Thief
Member
Registered: 12 Jul 2012
Posts: 169

Re: how clean up port scan output txt result

What output are you expecting?

If you're trying to get the output as 127.0.0.1:80 based on that scan result text, change your code to

for /f "eol=- tokens=3,4 delims= " %%A in ('type result.txt ^|find ^".^"') do (
IF [%%A] NEQ [Scan] (
  echo %%B:%%A>>list.txt
 )
)

Offline

#3 17 May 2017 08:38

msalman
Member
Registered: 02 Nov 2012
Posts: 9

Re: how clean up port scan output txt result

and i also need just ip code

127.0.0.1

Offline

#4 17 May 2017 11:50

Hackoo
Member
Registered: 05 Feb 2015
Posts: 14

Re: how clean up port scan output txt result

msalman wrote:

and i also need just ip code

127.0.0.1

Hi wink
You can try something like that :

@echo off
set "Result=result.txt"
set "IP_Port_Log=IP_Port.txt"
set "IP_Log=IP.txt"
If Exist "%IP_Port_Log%" Del "%IP_Port_Log%"
If Exist "%IP_Log%" Del "%IP_Log%"
For /f "eol=- tokens=3,4 delims= " %%A in ('type "%Result%" ^|find ^".^"') do (
	IF [%%A] NEQ [Scan] (
		echo %%B:%%A>>"%IP_Port_Log%"
		echo %%B>>"%IP_Log%"
	)
)
start "" "%IP_Port_Log%"
start "" "%IP_Log%"

Last edited by Hackoo (17 May 2017 15:40)

Offline

#5 17 May 2017 19:12

msalman
Member
Registered: 02 Nov 2012
Posts: 9

Re: how clean up port scan output txt result

thanks brother great work done big_smile

Offline

Board footer

Powered by FluxBB