Login Register






The stories and information posted here are artistic works of fiction and falsehood. Only a fool would take anything posted here as fact.
Thread Rating:
  • 2 Vote(s) - 4.5 Average


[HC Official] MAC Spoofer 2.0 filter_list
Author
Message
RE: Windows MAC address spoofer | V2.0 #8
Yeah, I can help a bit...

1. Replace all goto :end's with exit /b and get rid of :end

2. This isn't needed really:
Code:
cd %~dp0

3. You set arg to nothing, and then never use it after this:
Code:
set arg=

4. There's a better way than this:
Code:
set arg1=%1
if /i "%arg1%"=="-help" set arg1=
if defined arg1 goto arg1

Try this for instance:
Code:
@echo off
if [%1] neq [] if "%1" neq "-help" goto :program
:helpdoc
echo Help requested...
pause & exit /b

:program
echo Program started...
pause

Same thing applies to other arguments that you check.

5. Avoid naming block sections the same names as your variables:
Code:
:arg1

That can lead to trouble for debugging if you are writing a big script.

ASSOC is a command as well, so you should be a bit more unique than this:
Code:
:assoc

6. Last thing I would say is to validate the invoked script with the arguments by doing an arg count as a minimum, before you decide to use arg %1 for something %2, %3, and when you need %4 it doesn't exist...

edit: As for what @"Deque" pointed out:
Code:
if exist "con.txt" for /f "delims= tokens=*" %%k in ('type con.txt') do set con=%%k

You actually don't need type, /f is specific for files too, you just need this:
Code:
if exist "con.txt" for /f "tokens=*" %%k in (con.txt) do set con=%%k

As for those if statements:
Code:
if /i "%2"=="-c" set con=%3
if /i "%3"=="-c" set con=%4
if /i "%4"=="-c" set con=%5
if /i "%5"=="-c" set con=%6
if /i "%6"=="-c" set con=%7

You might be able to check then just shift the arguments. And assign to the same one since shifting is downwards. You aren't dealing with more than 9 arguments though, otherwise I usually create my own pseudo array of arguments...
ArkPhaze
"Object oriented way to get rich? Inheritance"
Getting Started: C/C++ | Common Mistakes
[ Assembly / C++ / .NET / Haskell / J Programmer ]

Reply





Messages In This Thread
[HC Official] MAC Spoofer 2.0 - by noize - 05-17-2013, 10:11 PM
[HC Official] MAC Spoofer 2.0 - by noize - 05-17-2013, 10:11 PM



Users browsing this thread: 1 Guest(s)