Re: How to do same as 'nmap' command from within a D program?

2022-01-24 Thread Adam D Ruppe via Digitalmars-d-learn
On Saturday, 22 January 2022 at 20:55:38 UTC, Daren Scot Wilson wrote: I'm writing a command line program to control certain hardware devices. I can hardcode or have in a config file the IP addresses for the devices, if I know that info. If I don't? Depending on the hardware, you might be

Re: How to do same as 'nmap' command from within a D program?

2022-01-24 Thread Daren Scot Wilson via Digitalmars-d-learn
On Sunday, 23 January 2022 at 06:30:11 UTC, frame wrote: On Saturday, 22 January 2022 at 20:55:38 UTC, Daren Scot Wilson wrote: I don't see any D std.* libraries that do this. Are there a Dub packages I should look at? If you really want to this in D without any external app or OS API you

Re: How to do same as 'nmap' command from within a D program?

2022-01-22 Thread frame via Digitalmars-d-learn
On Saturday, 22 January 2022 at 20:55:38 UTC, Daren Scot Wilson wrote: I don't see any D std.* libraries that do this. Are there a Dub packages I should look at? If you really want to this in D without any external app or OS API you could just ping all possible hosts, see which respond and

Re: How to do same as 'nmap' command from within a D program?

2022-01-22 Thread forkit via Digitalmars-d-learn
On Saturday, 22 January 2022 at 22:44:31 UTC, forkit wrote: and here is how to get the ip (depending on the formatting of your output of course) // --- module test; import std; void main() { auto result = execute(["bash", "-c", "nmap -sn 192.168.11.0/24 | ack -B2 \"Philips\""]);

Re: How to do same as 'nmap' command from within a D program?

2022-01-22 Thread forkit via Digitalmars-d-learn
On Saturday, 22 January 2022 at 23:15:18 UTC, forkit wrote: oh.. this is better i think... ip = str[ ((lastIndexOf(str, "(")) + 1) .. lastIndexOf(str, ")") ];

Re: How to do same as 'nmap' command from within a D program?

2022-01-22 Thread forkit via Digitalmars-d-learn
On Saturday, 22 January 2022 at 20:55:38 UTC, Daren Scot Wilson wrote: is this helpful: // --- module test; import std; void main() { auto result = execute(["bash", "-c", "nmap -sn 192.168.11.0/24 | ack -B2 \"Phillips\""]); if(canFind(result.to!string, "Host is up"))

How to do same as 'nmap' command from within a D program?

2022-01-22 Thread Daren Scot Wilson via Digitalmars-d-learn
I'm writing a command line program to control certain hardware devices. I can hardcode or have in a config file the IP addresses for the devices, if I know that info. If I don't? Then I run an 'nmap' command and look for the devices. But why should I, a human, have to do any work like that?