Our Feeds

Thursday 6 November 2014

Ajith KP

Reverse IP Look Up Code in PHP

          Reverse IP look up is most important step for a defacer hacker. This allow you to find other websites hosted in server. This is a sample code for reverse IP look up using PHP.

Link to Source Code: http://pastebin.com/VU6tXMeq


          Source Code

<?php
/*
 REVERSE IP IN PHP.
 CODED BY AJITH KP
 (C) http://terminalcoders.blogspot.in (C)
 http://fb.com/ajithkp560
*/
?>

<html>
<style>
html { background:url(http://www.ajithkp560.hostei.com/images/background.gif) black; }
#result{ -moz-border-radius: 10px; border-radius: 10px; border:1px solid green; padding:4px 8px; line-height:16px; background:#111111; color:#aaa; margin:0 0 8px 0; min-height:100px;}
input { font-size:11px; background:#191919; color:green; margin:0 4px; border:1px solid  green; }
    .tbl{ width:100%; padding:4px 0; color:#888; font-size:15px; text-align:center;  }
    .tbl a{ text-decoration:none; color:green; font-size:15px; vertical-align:middle; }
    .tbl a:hover{text-decoration:underline;}
    .tbl td{ border-bottom:1px solid #222222; padding:0 8px; line-height:24px;  vertical-align:middle; width: 300px; }
    .tbl th{ padding:3px 8px; font-weight:normal; background:#222222; color:#555; vertical-align:middle; }
    .tbl td:hover{ background:#181818; }
</style>
<title>REVERSE IP LOOK UP TOOL</title>
<div id=result>

<?php
echo "<center><br /><br /><form><input size='60' value='Enter Site' name='url' /><input type='submit' value='>>'></form></center>";
if(isset($_GET["url"]))
{
$site = $_GET["url"];
$url = "http://domains.yougetsignal.com/domains.php";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt($ch, CURLOPT_POSTFIELDS,  "remoteAddress=$site&ket=");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
$resp = curl_exec($ch);
$resp = str_replace("[","", str_replace("]","", str_replace("\"\"","", str_replace(", ,",",", str_replace("{","", str_replace("{","", str_replace("}","", str_replace(", ",",", str_replace(", ",",",  str_replace("'","", str_replace("'","", str_replace(":",",", str_replace('"','', $resp ) ) ) ) ) ) ) ) ) ))));
$array = explode(",,", $resp);
unset($array[0]);
echo "<table class=tbl>";
foreach($array as $lnk)
{
 print "<tr><td><a href='$lnk' target=_blank>$lnk</a></td></tr>";
}
echo "</table>";
curl_close($ch);
}
?>
</div>
</html>

Wednesday 5 November 2014

Ajith KP

Digital Camera Day or Night - Python Solution

          "You need to construct a feature in a Digital Camera, which will auto-detect and suggest to the photographer whether the picture should be clicked in day or night mode, depending on whether the picture is being clicked in the daytime or at night. You only need to implement this feature for cases which are directly distringuishable to the eyes (and not fuzzy scenarios such as dawn, dusk, sunrise, sunset, overcast skies which might require more complex aperture adjustments on the camera)."



          The above question is find here: https://www.hackerrank.com/contests/image-analysis-1/challenges/digital-camera-day-or-night

          The solution to this problem in Python



# (C) http://www.terminalcoders.blogspot.in (C)
# Originally scripted by Ajith Kp
from math import *
tmp = raw_input().strip(',\n').split(' ')
sb = 0
sg = 0
sr = 0
for i in tmp:
    i = i.split(',')
    for j in range(len(i)):
        try:
            if j%3==0:
                sb+=int(i[j])
            elif j%3==1:
                sg+=int(i[j])
            else:
                sr+=int(i[j])
        except Exception:
            pass
sr = (sr/len(tmp))/255.0
sg = (sg/len(tmp))/255.0
sb = (sg/len(tmp))/255.0
R = 0
G = 0
B = 0
if sr <= 0.03928:
    R = sr/12.92
else:
    R = pow((sr+0.055)/1.055, 2.4)
if sg <= 0.03928:
    G = sg/12.92
else:
    G = pow((sg+0.055)/1.055, 2.4)
if sb <= 0.03928:
    B = sb/12.92
else:
    G = pow((sb+0.055)/1.055, 2.4)
y = 0.2126*R+0.7152*G+0.0722*B
if y<0.07:
    print 'night'
else:
    print 'day'