The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. February 12, 2012, 12:41:17 AM

Login with username, password and session length


Pages: 1 [2]
  Print  
Author Topic: $_SERVER['REMOTE_ADDR'] is empty? how the??  (Read 4162 times)
lamontagne
Journeyman
***
Offline Offline

Posts: 89


View Profile
« Reply #15 on: September 25, 2009, 12:17:27 AM »

possibly they are ipv6 ? i dunno, sounds odd. you arent running php on iis by chance are you?

edit*** i say ipv6 because i think they come through in diff format on the php remote_addr variable and you might have some regex failing or data storage issue
« Last Edit: September 25, 2009, 12:21:53 AM by lamontagne » Logged

"Long time no see. I only pray the caliber of your questions has improved." - Kevin Smith
nutballs
Administrator
Lifer
*****
Offline Offline

Posts: 5604


Back in my day we had 9 planets


View Profile
« Reply #16 on: September 25, 2009, 06:35:20 AM »

Hmm that's 2 of you now say ip6. Hmm. I know, if ip longer than 15 save to file. That should do it.
Logged

I could eat a bowl of Alphabet Soup and shit a better argument than that.
lamontagne
Journeyman
***
Offline Offline

Posts: 89


View Profile
« Reply #17 on: September 25, 2009, 07:22:12 AM »

oops, didnt notice that perks already said it...
Logged

"Long time no see. I only pray the caliber of your questions has improved." - Kevin Smith
nutballs
Administrator
Lifer
*****
Offline Offline

Posts: 5604


Back in my day we had 9 planets


View Profile
« Reply #18 on: September 25, 2009, 07:57:04 AM »

heh. well you just made me actually consider it. I just ignored perk for some reason.

Actually the reason is, that I don't think my switch supports ip6, so I didnt even think of it. I keep forgetting this data is coming from servers where the infrastructure is out of my control.

Perk, that brings up a point... Do you think GetNet supports IP6 to the rack? obviously those cisco switches probably dont; but everything upstream might?
Logged

I could eat a bowl of Alphabet Soup and shit a better argument than that.
perkiset
Olde World Hacker
Administrator
Lifer
*****
Online Online

Posts: 9792



View Profile
« Reply #19 on: September 25, 2009, 01:31:50 PM »

Hmmm... good question and I've no answer. That's a jeffPing I believe. Claude would've known  Embarrassed
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
nutballs
Administrator
Lifer
*****
Offline Offline

Posts: 5604


Back in my day we had 9 planets


View Profile
« Reply #20 on: September 25, 2009, 07:06:58 PM »

this is driving me fucking bonkers.

Mozilla/5.0 (compatible; Yahoo! Slurp China; http://misc.yahoo.com.cn/help.html)

left no IP on one of the hits. SO.
This is obviously a problem on my end...

PHP

                     /"\
                    |\./|
                    |   |
                    |   |
                    |>~<|
                    |   |
                 /'\|   |/'\..
             /~\|   |   |   | \
                 |   =
  • =   |   |  \
            |   |   |   |   |   \
            | ~   ~   ~   ~ |`   )
            |                   /
             \                 /
              \               /
               \    _____    /
                |--//''`\--|
                | (( +==)) |
                |--\_|_//--|

Logged

I could eat a bowl of Alphabet Soup and shit a better argument than that.
lamontagne
Journeyman
***
Offline Offline

Posts: 89


View Profile
« Reply #21 on: September 25, 2009, 10:01:11 PM »

Are all of these requests that have no ip from bots? I'm guessing that your phone home system is setup to pass the ip through the querystring.. aka:

http://phonehomeserver.com/log.php?ip=127.0.0.1

is there a chance that somehow the url for this phonehome script got leaked and now the bots are crawling it and not passing the ip, aka...

http://phonehomeserver.com/log.php

the only thing that throws this off is the fact that you said user agent etc gets passed, but would the log.php default to the user agent of the requester if no user-agent is passed in the url...I looked for any bugs but I couldn't find any for this problem that didn't have to do with iis or with a version of php before 4.0....I'm just suggesting that somehow they got ahold of the phone home script address because the user agent for these two "null" ip visitors you have posted are bot user agents...

Edit***

I am not familiar with shorthand if/then statements (like in the code you posted)... but would it be possible for me to pass a space character or something else in the HTTP X FORWARD and your log script would log it as though it was blank... perhaps someone could translate that code for me so I can understand it? (I know, I'm ashamed I don't understand shorthand yet, but things like that usually get me in trouble with debugging so I don't bother)
« Last Edit: September 25, 2009, 10:14:17 PM by lamontagne » Logged

"Long time no see. I only pray the caliber of your questions has improved." - Kevin Smith
perkiset
Olde World Hacker
Administrator
Lifer
*****
Online Online

Posts: 9792



View Profile
« Reply #22 on: September 25, 2009, 10:38:34 PM »

An interesting point...

the code that NBs showed will look for emptiness (ie., either integer 0, string '0', false, and empty array etc) in those variables and degrade down through each one, until it passes a default value back.

If that function returned a blank, I'd quickly gin up an HTTP request to phone home and post all the headers and the content of the message right quick, including doing something like:

$ipBlock = <<<TEXT
Client_IP=({$_SERVER['HTTP_CLIENT_IP']})
Forwarded: ({$_SERVER['HTTP_X_FORWARDED_FOR']})
Remote_addr: ({$_SERVER['REMOTE_ADDR']}}
TEXT;

... even though they may be empty. This is weird enough that I'd want every friggin symptom I could possibly get my hands on. Just did a bit of quick looking - it seems that *everyone* assumes that Apache hooks the initial IP address and that is what's passed on to PHP - but I'm wondering, particularly since that's from China, if there's a way (akin to what VSloathe was creeping us out about the other day) to spoof that satisfactorily... or if PHP actually receives it's data from stdin rather than the Apache API hooks. You might want to write something to try to reconcile the Apache logs to your calls and see what's coming in.
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
nutballs
Administrator
Lifer
*****
Offline Offline

Posts: 5604


Back in my day we had 9 planets


View Profile
« Reply #23 on: September 26, 2009, 09:46:31 PM »

not just china, not just bots. It is seemingly completely random, and I am now positive that it is at the PHP level, because I could find the same exact entries in the weblogs, with an IP, but in my DB, there its blank.

I don't really know how this is possible though, because I am just sending via querystring,
$url .= 'ip='.urlencode($_SERVER['REMOTE_ADDR']);

I am going to bolt on the whole $_SERVER array and store that as well for a while. It's just that will slow stuff down a bit since its about 20 times bigger than the original parameters and I have 100's a second coming in. A short duration test will hopefully be enough.
Logged

I could eat a bowl of Alphabet Soup and shit a better argument than that.
serialnoob
Journeyman
***
Offline Offline

Posts: 86


View Profile
« Reply #24 on: October 16, 2009, 06:38:54 PM »

While coding a log system based on some of Perk's code here I had a similar issue on an hosted server, with no ip or strange ones that would not pass the ip check. I ended up reading this www.iana.org/faqs/abuse-faq.htm. my 2ct!
Logged

Success consists of going from failure to failure without loss of enthusiasm - Winston Churchill
nutballs
Administrator
Lifer
*****
Offline Offline

Posts: 5604


Back in my day we had 9 planets


View Profile
« Reply #25 on: October 16, 2009, 10:43:24 PM »

Interesting. I don't think that was my issue though.
Logged

I could eat a bowl of Alphabet Soup and shit a better argument than that.
Pages: 1 [2]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!