Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

Determine CLI arguments?

I want to produce a script that utilizes command-line arguments. So far I have this:
Code
Dim clArgs() As String = Environment.GetCommandLineArgs()
        If clArgs.Count <= 1 Then
            Environment.Exit(0).
        End If
Obviously if the user were to double-click the executable, it will exit since it wasn't called from the CLI w/ the appropriate arguments.

At this point however, I want to establish this synatx:
Code
my_program.exe -h http://www.example.com -m GET -r -t 50
Basically I'm trying to get and values following -h (for host), -m (for method), and then the -t (for threads).


I assume I would have to determine their index, right? I'm having trouble getting the values and setting them in global variables. If anyone could help me I would greatly appreciate it <3
https://docs.microsoft.com/en-us/dotnet/...ew=net-5.0
[Image: bitcoin.png] Be Nice For Once 15hVUVz7xA4kazHdk2BuErENGCskVwjYXP
(Jul 10, 2021 01:52 PM)HFDone Wrote:  https://docs.microsoft.com/en-us/dotnet/...ew=net-5.0

So I comprehend that. If you follow the link you posted, in the example it shows the user how to loop through the values inputted via CLI. I get that. That's not my issue. I'm having trouble determining the order of what was posted. So if the user throws the -m switch, I want to know if the user inputted either GET or POST (one of two http methods) and set that value as a string variable. That's what I'm stuck on. I'm lost on how I would even begin.
you have args array check them
if args(1) = "-m" then ... check args(2) value
[Image: bitcoin.png] Be Nice For Once 15hVUVz7xA4kazHdk2BuErENGCskVwjYXP
(Jul 11, 2021 06:44 AM)HFDone Wrote:  you have args array check them
if args(1) = "-m" then ... check args(2) value

Ahhh, I see. I'll give that a shot. Thanks!


Possibly Related Threads...
Thread / Author Replies Views Last Post
by HackersNov 11, 2025 09:42 AM 0 205 Nov 11, 2025 09:42 AM
Last Post: Hackers
by HackersDec 11, 2024 05:11 PM 21 534 Dec 11, 2024 05:11 PM
Last Post: padrino
by HackersDec 11, 2024 08:31 AM 23 693 Dec 11, 2024 08:31 AM
Last Post: Hackers