Home > other >  [for] about golang nmap command execution problem...
[for] about golang nmap command execution problem...

Time:11-21

Problem: the code can run normally, IPlist can read properly, but all of the generated IP. TXT file content is empty, what reason is this? Please, help to see...

(if the command directly to cmdValue:="nmap - T4 - F IP," project. TXT in the scan results is normal)

The code is as follows:

 
Func delRec () {

CmdValue:="for/f % I in (D:/goproject/SRC/Project/outfile IPlist. TXT) do " D:/Program Files (x86)/Nmap Nmap. Exe \ "- T4 - p - 65535 - v % 1 I & gt; D:/goproject/SRC/Project/outfile/% i.t xt
"
Println (" cmdValue="HTTP://https://bbs.csdn.net/topics/+cmdValue)

CMD:=exec.Com mand (" CMD ", "/C", cmdValue)

Outfile, err:=OS. The Create (" D:/goproject/SRC/Project1/outfile/project. TXT ")
if err ! Nil={
Panic (err)
}

CMD. Stdout=outfile

Err=CMD. Start ();
if err ! Nil={
Panic (err)
}
CMD. Wait ()

Defer outfile. Close ()
}
  • Related