Jump to content

64bit OS detection


mencargo
 Share

Recommended Posts

Hi there, I'm searching for a way to detect if the host OS is 64bit or 32bit.

Is there any enviroment varable for this? (Available from ms-dos)

Or any way to detect it with a vbs script?

I was thinking something like:

ver|find /c "X.X."

or

echo %programfiles%|find /c "(x86)"

And, just curiosity, why do some usb payloads use "%windir%\system32\find.exe"?

Isn't find available as default everywhere?

Link to comment
Share on other sites

Hi there, I'm searching for a way to detect if the host OS is 64bit or 32bit.

Is there any enviroment varable for this? (Available from ms-dos)

Or any way to detect it with a vbs script?

I was thinking something like:

ver|find /c "X.X."

or

echo %programfiles%|find /c "(x86)"

And, just curiosity, why do some usb payloads use "%windir%\system32\find.exe"?

Isn't find available as default everywhere?

Try this. It was implemented into Leapo's Pocket Knife and it works. ;)

Link to comment
Share on other sites

Well, I'm developing my own payload because pocket knife doesn't work like it should, I was discussing it inside that thread.

The OS recognition fails if the Windows is not English, that's why I was thinking about finding "(x86)" at the program files path, although I'm not sure if it's universally named with (x86) at any language.

Link to comment
Share on other sites

Well, I'm developing my own payload because pocket knife doesn't work like it should, I was discussing it inside that thread.

The OS recognition fails if the Windows is not English, that's why I was thinking about finding "(x86)" at the program files path, although I'm not sure if it's universally named with (x86) at any language.

Sorry, I posted you to the incorrect link...

For any language system, you can do this

For all languages OS detection, If you modify:

ver|find "[Version 5.00."
if errorlevel 1 goto SetOSwin2k
ver|find "[Version 5.1."
if errorlevel 1 goto SetOSXP32
ver|find "[Version 5.2."
if errorlevel 1 goto SetOSXP64
ver|find "[Version 6.0."
if errorlevel 1 goto SetOSVISTA32
ver|find "[Version 6.???"
if errorlevel 1 goto SetOSVISTA64
:SetOSDefault
goto SetOSXP32
:SetOSwin2k
SET CurrentOS=win2k
GOTO EndDetect
:SetOSXP32
SET CurrentOS=XP32
GOTO EndDetect
:SetOSXP64
SET CurrentOS=XP64
GOTO EndDetect
:SetOSVISTA32
SET CurrentOS=VISTA32
GOTO EndDetect
:SetOSVISTA64
SET CurrentOS=VISTA64
GOTO EndDetect
:EndDetect

The code will not work for spanish systems (or other I supose), because the ver command shows lines as "VersiĆ³n 5.00....". You can modify the code with:

ver|find "5.00."
if errorlevel 1 goto SetOSwin2k
ver|find "5.1."
if errorlevel 1 goto SetOSXP32
ver|find "5.2."
if errorlevel 1 goto SetOSXP64
ver|find "6.0."
if errorlevel 1 goto SetOSVISTA32
ver|find "6.???"
if errorlevel 1 goto SetOSVISTA64
:SetOSDefault
goto SetOSXP32
:SetOSwin2k
SET CurrentOS=win2k
GOTO EndDetect
:SetOSXP32
SET CurrentOS=XP32
GOTO EndDetect
:SetOSXP64
SET CurrentOS=XP64
GOTO EndDetect
:SetOSVISTA32
SET CurrentOS=VISTA32
GOTO EndDetect
:SetOSVISTA64
SET CurrentOS=VISTA64
GOTO EndDetect
:EndDetect

It will work for all languages OS's. ;)

posted Here!

Link to comment
Share on other sites

  • 2 weeks later...
Fail. Server 2003 identifies as 5.2, regardless of whether it's 32 or 64bit. This is due to the fact that XP64 is essentially a client version of Server 2003.

:angry: That's occurs when one can't try it in Server 2003... Ok, another thing to think about! <_< I'll be squishing my little brain to find a solution (in batch) for helping in the payload development. Thanks a lot for your memo moonlit.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...