Author Topic: CMD tool to get external and local IPs  (Read 14628 times)

0 Members and 1 Guest are viewing this topic.

Offline Kulverstukas

  • Administrator
  • Zeus
  • *
  • Posts: 6627
  • Cookies: 542
  • Fascist dictator
    • View Profile
    • My blog
CMD tool to get external and local IPs
« on: December 07, 2011, 08:31:12 pm »
Needed a tool to show me my external IP.
"ipconfig /all" doesn't show it so here is a little program to get external and local IPs.
Put it into WINDOWS folder and then you can issue "cmdip" command from anywhere in the CMD and get your IPs.

Code: http://newage.ql.lt/projects/delphi/CMDIP/CMDIP.zip
Compiled exe: http://newage.ql.lt/projects/delphi/CMDIP/cmdip.exe
« Last Edit: December 08, 2011, 09:26:57 pm by Kulverstukas »

Offline neusbeer

  • Knight
  • **
  • Posts: 223
  • Cookies: 11
  • Beer makes you stronger XD
    • View Profile
    • http://www.facebook.nl/hackneus
Re: CMD tool to get external and local IPs
« Reply #1 on: December 08, 2011, 08:23:44 pm »
Nice one! Thnxs.. I always forget my external ip..
hmm.. can't open the source with lazarus.
time for me to install delphi again..  :D
--Neusbeer

Offline Kulverstukas

  • Administrator
  • Zeus
  • *
  • Posts: 6627
  • Cookies: 542
  • Fascist dictator
    • View Profile
    • My blog
Re: CMD tool to get external and local IPs
« Reply #2 on: December 08, 2011, 09:26:21 pm »
Nice one! Thnxs.. I always forget my external ip..
hmm.. can't open the source with lazarus.
time for me to install delphi again..  :D
Yeah usually I code with "Embarcadero Delphi Architect 2010". Stopped doing it with lazarus long time ago. It really cannot be compared to the commercial solution. I suppose it's good when you need to code Delphi in Linux :P it just lacks lots of functionality and support.

Offline neusbeer

  • Knight
  • **
  • Posts: 223
  • Cookies: 11
  • Beer makes you stronger XD
    • View Profile
    • http://www.facebook.nl/hackneus
Re: CMD tool to get external and local IPs
« Reply #3 on: December 09, 2011, 03:34:18 pm »
true true.. I use it for small and fast building of apps/tools.
it's indeed nothing compared with Delphi as-if.
Support is minimal, one great thing. It can be used as portable.
So no installation needed, and that's for me a good thing.
(Install list is toooo big now.. in windows then)
Embarcadero is language depended it think?
Doesn't ring a bell :D
I still use delphi7
ahh well.. and because of my girlfriends new study
I'm learning C/C++.
And for my pentest/hack moments C++ is my new friend haha..
Ideal for buffer overflowing and such.
But I'm to much in to delphi, so C/C++ is hard to learn.
And Delphi in Linux.. hmm. why? :P
I was looking for a nice and easy way for cross-compiling
tools. and found Qt4 from Nokia. but it's so lame.. :P
--Neusbeer

Offline Kulverstukas

  • Administrator
  • Zeus
  • *
  • Posts: 6627
  • Cookies: 542
  • Fascist dictator
    • View Profile
    • My blog
Re: CMD tool to get external and local IPs
« Reply #4 on: December 09, 2011, 07:22:01 pm »
Delphi 7 was from Borland. It's called Embarcadero since Delphi 2009 or something. Borland did release a Linux version of their IDE called Kylix. I haven't tried it TBH, but FreePascal (Lazarus compiler) comes for all sorts of systems.
Embarcadero is a company, not IDE :D tho Delphi achitect 2010 has both, Delphi and C/++ IDE and compilers in one. Kinda neat and it's very good as well.

Offline neusbeer

  • Knight
  • **
  • Posts: 223
  • Cookies: 11
  • Beer makes you stronger XD
    • View Profile
    • http://www.facebook.nl/hackneus
Re: CMD tool to get external and local IPs
« Reply #5 on: December 10, 2011, 01:02:12 pm »
ah I'm just a few years behind  :o
When I search for a good torrent I find Embarcadero RAS studio 2010
is this the one?
--Neusbeer

Offline Kulverstukas

  • Administrator
  • Zeus
  • *
  • Posts: 6627
  • Cookies: 542
  • Fascist dictator
    • View Profile
    • My blog
Re: CMD tool to get external and local IPs
« Reply #6 on: December 10, 2011, 03:03:30 pm »
Yeah I think it is. It's the name of the suite... and it's RAD (Rapid Application development), not RAS :P

Z3R0

  • Guest
Re: CMD tool to get external and local IPs
« Reply #7 on: December 10, 2011, 05:14:21 pm »
....
I was looking for a nice and easy way for cross-compiling
tools.
....
mingw will cross-compile C/C++ windows code on linux.
Code: [Select]
http://www.mingw.org

Offline neusbeer

  • Knight
  • **
  • Posts: 223
  • Cookies: 11
  • Beer makes you stronger XD
    • View Profile
    • http://www.facebook.nl/hackneus
Re: CMD tool to get external and local IPs
« Reply #8 on: December 10, 2011, 07:27:44 pm »
yes I know. I use it with Cygwin (linux in windows) to compile.

But that's C/C++ and still learning that. :)

--Neusbeer

Offline waste

  • NULL
  • Posts: 1
  • Cookies: 0
    • View Profile
Re: CMD tool to get external and local IPs
« Reply #9 on: May 07, 2012, 06:31:10 pm »
yeah thanks for the url !!!

i coded stuff like that using www.whatismyip.com or else , and using the pos function,  if the text changes my code return characters !!

it was for an old project for a worm , i used an url like that to get smtp from the target computer too


Offline iTpHo3NiX

  • EZ's Pirate Captain
  • Administrator
  • Titan
  • *
  • Posts: 2920
  • Cookies: 328
    • View Profile
    • EvilZone
Re: CMD tool to get external and local IPs
« Reply #10 on: May 07, 2012, 07:56:02 pm »
My dad coded one in batch :P

GetIP.bat
Code: [Select]
@echo off
color 4f
cls
cscript getip.js | find /i "hostname">extip.lst
for /f "tokens=1,2*" %%i in (extip.lst) do (
if "%%i"=="<p><b>Hostname</b>:" echo %%j>realip.lst
)
for /f "tokens=1,2,3,4* delims=.-" %%i in (realip.lst) do (
echo Real XTWAN IP: %%i.%%j.%%k.%%l>wanip.lst
echo iNet Provider: %%m>Provider.lst
)
if exist extip.lst del extip.lst
if exist realip.lst del realip.lst

GetIP.js
Code: [Select]
var request = new ActiveXObject("Msxml2.XMLHTTP");
var notyetready = 1;

request.onreadystatechange=function()
{
if(request.readyState==4)
{
WScript.Echo(request.responseText);
notyetready = 0;
}
}

request.open( "GET", "http://www.whatsmyip.org/more/", true );
request.send(null);

while( notyetready )
{
WScript.Sleep( 100 );
}

Will display external and internal IP address. It was programmed to add a feature to my iTStealer :P however your little program could work just like the nirsoft tools.. *Will save for future reference*
[09:27] (+lenoch) iTpHo3NiX can even manipulate me to suck dick
[09:27] (+lenoch) oh no that's voluntary
[09:27] (+lenoch) sorry

V0R73X

  • Guest
Re: CMD tool to get external and local IPs
« Reply #11 on: May 24, 2012, 04:39:09 am »
The JS one wouldn't work on all browsers tho just IE...
The batch one didn't work on mine, apparently it doesn't write anything to the realip.lst file since it doesn't find it.
Kulverstakus' was a good one.
« Last Edit: May 24, 2012, 04:44:14 am by V0R73X »

Offline frog

  • Knight
  • **
  • Posts: 232
  • Cookies: 16
    • View Profile
Re: CMD tool to get external and local IPs
« Reply #12 on: May 24, 2012, 09:35:49 pm »
Here's one I made in Python; unfortunately all of our scripts rely on outside servers..
Code: (python) [Select]

#!/usr/bin/python
##
### getip.py - get external ip from ipchicken.com
##
#
import httplib


conn = httplib.HTTPConnection("ipchicken.com")
conn.request("GET", "/")
resp = conn.getresponse()


if resp.status != 200:
print resp.status, resp.reason
exit()
elif resp.status == 200:
output = resp.read()
output = output[output.find('<font face="Verdana, Arial, Helvetica, sans-serif" size="5" color="#0000FF"><b>'):
output.find('<A HREF="javascript:makeLink()"><font size="2">')]
output = output.strip('font face="Verdana, Arial, Helvetica, sans-serif" size="5" color="#0000FF"><b>')
output = output.strip()
output = output.strip('<br>')
print output
else:
print resp.status, resp.reason
exit()
« Last Edit: June 01, 2012, 10:58:26 pm by frog »

Offline iTpHo3NiX

  • EZ's Pirate Captain
  • Administrator
  • Titan
  • *
  • Posts: 2920
  • Cookies: 328
    • View Profile
    • EvilZone
Re: CMD tool to get external and local IPs
« Reply #13 on: July 09, 2012, 10:40:58 pm »
asdf
« Last Edit: February 13, 2013, 11:29:17 am by DeepCopy »
[09:27] (+lenoch) iTpHo3NiX can even manipulate me to suck dick
[09:27] (+lenoch) oh no that's voluntary
[09:27] (+lenoch) sorry

V0R73X

  • Guest
Re: CMD tool to get external and local IPs
« Reply #14 on: July 12, 2012, 02:25:10 am »
The files go hand in hand... if you actually LOOK at the batch file it calls the JS file. You need to create BOTH files, then run the batch file and it will display as described ;)

Example:
Line 4 of the batch file:
Code: [Select]
cscript getip.js | find /i "hostname">extip.lst
there u go ;)
Yes that's true, but the JS script calls for an ActiveX object and ActiveX is only supported by IE, which is why it only works on IE and not other browsers...