Help With Obtaining An IP Address
Moderators: Dorian (MJT support), JRL
- CyberCitizen
- Automation Wizard
- Posts: 721
- Joined: Sun Jun 20, 2004 7:06 am
- Location: Adelaide, South Australia
Help With Obtaining An IP Address
Hey Guys,
I Need Some Help With Obtaining A Users IP Address. The User Will Upload A File Via A Dialog Box, However I Need To Log The User IP Address With The File.
Here Is My Script.
HTTPRequest>http://checkip.dyndns.org/,,GET,,HTMLResponse
MessageModal>%HTMLResponse%
Is There Anyway I Can Just Return The IP Address.
I Was Thinking Of Sub>14 Spaces However That Only Works With Numbers.
Any Help You Could Provide Would Be Great.
I Need Some Help With Obtaining A Users IP Address. The User Will Upload A File Via A Dialog Box, However I Need To Log The User IP Address With The File.
Here Is My Script.
HTTPRequest>http://checkip.dyndns.org/,,GET,,HTMLResponse
MessageModal>%HTMLResponse%
Is There Anyway I Can Just Return The IP Address.
I Was Thinking Of Sub>14 Spaces However That Only Works With Numbers.
Any Help You Could Provide Would Be Great.
FIREFIGHTER
- CyberCitizen
- Automation Wizard
- Posts: 721
- Joined: Sun Jun 20, 2004 7:06 am
- Location: Adelaide, South Australia
Never Mind I Worked Out The Script.
//Users IP Address
HTTPRequest>http://checkip.dyndns.org/,,GET,,HTMLResponse
Position>Current IP Address: ,%HTMLResponse%,1,StartPos
Let>%StartPos%=%StartPos%+20
MidStr>%HTMLResponse%,57,13,IPAddress
MessageModal>%IPAddress%
If Anyone Else Has A Neater Idea Let Me Know But At This Stage Its Working.
//Users IP Address
HTTPRequest>http://checkip.dyndns.org/,,GET,,HTMLResponse
Position>Current IP Address: ,%HTMLResponse%,1,StartPos
Let>%StartPos%=%StartPos%+20
MidStr>%HTMLResponse%,57,13,IPAddress
MessageModal>%IPAddress%
If Anyone Else Has A Neater Idea Let Me Know But At This Stage Its Working.
FIREFIGHTER
Hi CyberCitizen:CyberCitizen wrote:Never Mind I Worked Out The Script.
If Anyone Else Has A Neater Idea Let Me Know But At This Stage Its Working.
Thanks for the link to dyndns ip page, I've used their free services in the past but never noticed that page.
I've been meaning to ask you if you have title case script (because I notice you post in title case) - if you do would you mind please posting it?
Thanks!
Best Wishes,
Monkster
Monkster
- CyberCitizen
- Automation Wizard
- Posts: 721
- Joined: Sun Jun 20, 2004 7:06 am
- Location: Adelaide, South Australia
Ha Ha Monkster,
Sorry No Script There. Thats Just How I Have Typed For A While.
Worked With Alot Of Addresses So Everything Became Second Nature When Typing.
I Also Have A Bug in My Script.
The Script Works Fine If The IP Address Is 123.12.12.123 But It The IP Address Is Longer Or Shorter It Will Not Work.
I Have Been Playing Around With A Few New Ideas But Still Cant Seem To Get It Working.
//Users IP Address
HTTPRequest>http://checkip.dyndns.org/,,GET,,HTMLResponse
Position>Current IP Address: ,%HTMLResponse%,1,StartPos
Position>,%HTMLResponse%,1,EndPos
Let>%StartPos%=%StartPos%+20
Let>%EndPos%=%EndPos%-14
Len>%HTMLResponse%,SourceLength
Let>FinishLen=%SourceLength%-%EndPos%
MidStr>%HTMLResponse%,%StartPos%,%FinishLen%,IPAddress
MessageModal>%IPAddress%
Please Help!
Sorry No Script There. Thats Just How I Have Typed For A While.
Worked With Alot Of Addresses So Everything Became Second Nature When Typing.
I Also Have A Bug in My Script.
The Script Works Fine If The IP Address Is 123.12.12.123 But It The IP Address Is Longer Or Shorter It Will Not Work.
I Have Been Playing Around With A Few New Ideas But Still Cant Seem To Get It Working.
//Users IP Address
HTTPRequest>http://checkip.dyndns.org/,,GET,,HTMLResponse
Position>Current IP Address: ,%HTMLResponse%,1,StartPos
Position>,%HTMLResponse%,1,EndPos
Let>%StartPos%=%StartPos%+20
Let>%EndPos%=%EndPos%-14
Len>%HTMLResponse%,SourceLength
Let>FinishLen=%SourceLength%-%EndPos%
MidStr>%HTMLResponse%,%StartPos%,%FinishLen%,IPAddress
MessageModal>%IPAddress%
Please Help!
FIREFIGHTER
Does this look ok?
//Users IP Address
HTTPRequest>http://checkip.dyndns.org/,,GET,,HTMLResponse
Position>Current IP Address: ,%HTMLResponse%,1,StartPos
Let>%StartPos%=%StartPos%+20
MidStr>%HTMLResponse%,57,15,IPAddress
StringReplace>%IPAddress%,%IPAddress%, ,,IPAddress
MessageModal>%IPAddress%
//Users IP Address
HTTPRequest>http://checkip.dyndns.org/,,GET,,HTMLResponse
Position>Current IP Address: ,%HTMLResponse%,1,StartPos
Let>%StartPos%=%StartPos%+20
MidStr>%HTMLResponse%,57,15,IPAddress
StringReplace>%IPAddress%,%IPAddress%, ,,IPAddress
MessageModal>%IPAddress%
Best Wishes,
Monkster
Monkster
- CyberCitizen
- Automation Wizard
- Posts: 721
- Joined: Sun Jun 20, 2004 7:06 am
- Location: Adelaide, South Australia
Hey Monkster,
Thanks For The Script It Kind Of Work's However Still Not Quite What I Need.
I Need It To Stop At The End Of The IP Address, The Script You Posted Includes The Extra Information At The End Of The Source.
This Is What %HTMLResponse% Returns. What I Am Trying To Obtain Is The IP Address Only. I Have Been Able To Get The Starting Position Ok, However I Can't Get It To Stop At The End Of The IP Address Or Forget The Last Part Of The %HTMLResponse%
Current IP CheckCurrent IP Address: 210.11.52.185
Please Help, This Is Starting To Get A Little Urgent Now. Thats For Your Help By The Way.
Thanks For The Script It Kind Of Work's However Still Not Quite What I Need.
I Need It To Stop At The End Of The IP Address, The Script You Posted Includes The Extra Information At The End Of The Source.
This Is What %HTMLResponse% Returns. What I Am Trying To Obtain Is The IP Address Only. I Have Been Able To Get The Starting Position Ok, However I Can't Get It To Stop At The End Of The IP Address Or Forget The Last Part Of The %HTMLResponse%
Current IP CheckCurrent IP Address: 210.11.52.185
Please Help, This Is Starting To Get A Little Urgent Now. Thats For Your Help By The Way.
FIREFIGHTER
Hi CyberCitizen,
Sorry about that, my last post was way off, don't know what happened it worked at the time. I must have pasted some interim code.
This is not pretty but it will work. The longest that the IP could be is 15 characters and it starts at position 77 so I think this will work. I am not sure what the lowest string length of an IP is so uncomment as needed.
//Users IP Address
HTTPRequest>http://checkip.dyndns.org/,,GET,,HTMLResponse
MidStr>%HTMLResponse%,77,15,IPAddress
StringReplace>%IPAddress%,/,,IPAddress
StringReplace>%IPAddress%,%IPAddress%, ,,IPAddress
StringReplace>%IPAddress%,b,,IPAddress
StringReplace>%IPAddress%,o,,IPAddress
//StringReplace>%IPAddress%,d,,IPAddress
//StringReplace>%IPAddress%,y,,IPAddress
//StringReplace>%IPAddress%,>,,IPAddress
//StringReplace>%IPAddress%,h,,IPAddress
//StringReplace>%IPAddress%,t,,IPAddress
//StringReplace>%IPAddress%,m,,IPAddress
//StringReplace>%IPAddress%,l,,IPAddress
MessageModal>%IPAddress%
Sorry about that, my last post was way off, don't know what happened it worked at the time. I must have pasted some interim code.
This is not pretty but it will work. The longest that the IP could be is 15 characters and it starts at position 77 so I think this will work. I am not sure what the lowest string length of an IP is so uncomment as needed.
//Users IP Address
HTTPRequest>http://checkip.dyndns.org/,,GET,,HTMLResponse
MidStr>%HTMLResponse%,77,15,IPAddress
StringReplace>%IPAddress%,/,,IPAddress
StringReplace>%IPAddress%,%IPAddress%, ,,IPAddress
StringReplace>%IPAddress%,b,,IPAddress
StringReplace>%IPAddress%,o,,IPAddress
//StringReplace>%IPAddress%,d,,IPAddress
//StringReplace>%IPAddress%,y,,IPAddress
//StringReplace>%IPAddress%,>,,IPAddress
//StringReplace>%IPAddress%,h,,IPAddress
//StringReplace>%IPAddress%,t,,IPAddress
//StringReplace>%IPAddress%,m,,IPAddress
//StringReplace>%IPAddress%,l,,IPAddress
MessageModal>%IPAddress%
Best Wishes,
Monkster
Monkster
My two cents worth:
You just need to write an old-fashioned filter to only include the valid characters in the IP address.
Of course, use a POS> to find the start of the IP address, then just read character by character to the end of the IP. Here is an example of a filter I use to strip out the order qty from a text file.
rem> find the order qty
let>qtyStart=dollarSign-6
let>Digit=0
REM> As valid characters are found,they are 'stuffed' into this string
let>OrdQty=
rem> determine a string that will be your RAW data string (trash and all)
midstr>%OrderText%,%qtyStart%,6,RawQty
len>%RawQty%,lengthOrdQty
Label>QtyDigit
rem> increment the digit counter
let>Digit=Digit+1
rem> pull out a single digit from the string to be tested
Midstr>%RawQty%,%Digit%,1,DigitResult
rem> Try to locate the current digit within the Valid string
Pos>%DigitResult%,%ValidNbr%,1,Found
if>%Found%>0
Concat>OrdQty,DigitResult
endif>
rem> if you have not reached the end of the string, then continue checking
if>%Digit%QtyDigit
endif>
The result will be that once the end is reached, the OrdQty variable will only hold characters which are in my "Valid" list.
your valid list would be LET>ValidIP=0123456789.
clear as mud?
I know reading someone else's code is never very easy.
Ask and I can clarify it.
SkunkWorks
You just need to write an old-fashioned filter to only include the valid characters in the IP address.
Of course, use a POS> to find the start of the IP address, then just read character by character to the end of the IP. Here is an example of a filter I use to strip out the order qty from a text file.
rem> find the order qty
let>qtyStart=dollarSign-6
let>Digit=0
REM> As valid characters are found,they are 'stuffed' into this string
let>OrdQty=
rem> determine a string that will be your RAW data string (trash and all)
midstr>%OrderText%,%qtyStart%,6,RawQty
len>%RawQty%,lengthOrdQty
Label>QtyDigit
rem> increment the digit counter
let>Digit=Digit+1
rem> pull out a single digit from the string to be tested
Midstr>%RawQty%,%Digit%,1,DigitResult
rem> Try to locate the current digit within the Valid string
Pos>%DigitResult%,%ValidNbr%,1,Found
if>%Found%>0
Concat>OrdQty,DigitResult
endif>
rem> if you have not reached the end of the string, then continue checking
if>%Digit%QtyDigit
endif>
The result will be that once the end is reached, the OrdQty variable will only hold characters which are in my "Valid" list.
your valid list would be LET>ValidIP=0123456789.
clear as mud?
I know reading someone else's code is never very easy.
Ask and I can clarify it.
SkunkWorks
- CyberCitizen
- Automation Wizard
- Posts: 721
- Joined: Sun Jun 20, 2004 7:06 am
- Location: Adelaide, South Australia
Hey Monkster,
Thanks For Your Script That Seemed To Have Worked. I Had To Add A Small Adjustment But So Far Everything Looks Good.
This Is What The Script Was For.
Program: http://cybercitizen.egn.com.au/EGN%20De ... loader.exe
Where The File Is Uploaded: http://cybercitizen.egn.com.au/hacker_demos
Thanks For Your Script That Seemed To Have Worked. I Had To Add A Small Adjustment But So Far Everything Looks Good.
This Is What The Script Was For.
Program: http://cybercitizen.egn.com.au/EGN%20De ... loader.exe
Where The File Is Uploaded: http://cybercitizen.egn.com.au/hacker_demos
FIREFIGHTER