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zUNalWuA4+YZajLQmcgj5pJ6n58 6eL8XlQVOFQY+xyqcvLjbUardYm0ZKmV7BDXpdDWppqFmFMAEQEAAYkCHwQYAQgA CQUCV567qQIbDAAKCRAEEk8sy1wMG10pD/47eYQ6tP3i20/TyCkuaa0E13qxEfO9 uLfS73bzFy4ZzejV5X0RMcbwOGz4U7S15hhoG58bcqUi2a+xYiulMfUSa91RfPp7 TSgLlcNUB686K3EwSEwMv7J2kyjDhETZcSwhjneApfCNP3U6juzVnYm8CTD+na3K qLAHAErhH2IIfwecSG8PuRn+BZuJUs84Gzu52iUSOV05UsCz8w6urGkv+Smkayc4 +qn7UH13eDuMtf6FYDnFYFUzJaMHSBSJR03Vv9tWgMEQ/ilfHikbPAsZBTapiqK3 Xpz3q5gzmIyOAbivtQxVMLk5NNYYcb4No5WTEpwRgGcu3eMMpjiBHwHP3Z533Cfl ySB3xNixt4lVT41cZEYctFqU6+76ddrR+yzQcK4Ko4CyZvXOGJMHod98/ayqu4vP h3WCLSaBZH1qeTlQyM69ALc6et51qwW4a2pZ9SFkzhTN0W5bpe7xAG0uPEzWNuUq k3ZnNG5CDH8N0HcJjP0MYD/I5JXLO1VheumW25Q6BGQmq+sJGWLbaKmwGKpj4UXw nDmaXLKFZWzGRIPB60P7XsrTP8kYxw7OR73V/jcUnXVyxh/kkD0D/SH1cFup/MXx 68AzB31L/3PnqhJcoJ76zBDUq5XC7v+ur1aTycZan2bBFUCpoK+ulIABlJG4niTr kYQzxl8+6IM0bQ== =HMHx —–END PGP PUBLIC KEY BLOCK—– • Equation Group Cyber Weapons Auction - Invitation —–BEGIN PGP SIGNED MESSAGE—– Hash: SHA256 From: bitmessage = BM-NBvAHfp5Y6wBykgbirVLndZtEFCYGht8 i2p-bote = o1uHOkOcMoFEa7O7dbEilzfMvWzo7bDu~td3x9gYz4b4t5OriJ7U6GUWr5GZoWxQ9f2TrIY5RzhpIMVP6hTLXZ Equation Group Cyber Weapons Auction - Invitation - ———————————————— !!! Attention government sponsors of cyber warfare and those who profit from it !!!! How much you pay for enemies cyber weapons? Not malware you find in networks. Both sides, RAT + LP, full state sponsor tool set? We find cyber weapons made by creators of stuxnet, duqu, flame. Kaspersky calls Equation Group. We follow Equation Group traffic. We find Equation Group source range. We hack Equation Group. We find many many Equation Group cyber weapons. You see pictures. We give you some Equation Group files free, you see. This is good proof no? You enjoy!!! You break many things. You find many intrusions. You write many words. But not all, we are auction the best files. Picture Urls - ———— http://imgur.com/a/sYpyn https://theshadowbrokers.tumblr.com/ https://github.com/theshadowbrokers/EQGRP-AUCTION File Urls - ———- magnet:?xt=urn:btih:40a5f1514514fb67943f137f7fde0a7b5e991f76&tr=http://diftracker.i2p/announce.php https://mega.nz/#!zEAU1AQL!oWJ63n-D6lCuCQ4AY0Cv_405hX8kn7MEsa1iLH5UjKU https://app.box.com/s/amgkpu1d9ttijyeyw2m4lso3egb4sola https://www.dropbox.com/s/g8kvfl4xtj2vr24/EQGRP-Auction-Files.zip https://ln.sync.com/dl/5bd1916d0#eet5ufvg-tjijei4j-vtadjk6b-imyg2qkd https://yadi.sk/d/QY6smCgTtoNz6 Free Files (Proof) - —————— eqgrp-free-file.tar.xz.gpg sha256sum = b5961eee7cb3eca209b92436ed7bdd74e025bf615b90c408829156d128c7a169 gpg –decrypt –output eqgrp-free-file.tar.xz eqgrp-free-file.tar.xz.gpg Password = theequationgroup Auction Files - ————- eqgrp_auction_file.tar.xz.asc sha256sum = af1dabd8eceec79409742cc9d9a20b9651058bbb8d2ce60a0edcfa568d91dbea Password = ???? Auction Instructions - ——————– We auction best files to highest bidder. Auction files better than stuxnet. Auction files better than free files we already give you. The party which sends most bitcoins to address: 19BY2XCgbDe6WtTVbTyzM9eR3LYr6VitWK before bidding stops is winner, we tell how to decrypt. Very important!!! When you send bitcoin you add additional output to transaction. You add OP_Return output. In Op_Return output you put your (bidder) contact info. We suggest use bitmessage or I2P-bote email address. No other information will be disclosed by us publicly. Do not believe unsigned messages. We will contact winner with decryption instructions. Winner can do with files as they please, we not release files to public. FAQ - — Q: Why I want auction files, why send bitcoin? A: If you like free files (proof), you send bitcoin. If you want know your networks hacked, you send bitcoin. If you want hack networks as like equation group, you send bitcoin. If you want reverse, write many words, make big name for self, get many customers, you send bitcoin. If want to know what we take, you send bitcoin. Q: What is in auction files? A: Is secret. Equation Group not know what lost. We want Equation Group to bid so we keep secret. You bid against Equation Group, win and find out or bid pump price up, piss them off, everyone wins. Q: What if bid and no win, get bitcoins back? A: Sorry lose bidding war lose bitcoin and files. Lose Lose. Bid to win! But maybe not total loss. Instead to losers we give consolation prize. If our auction raises 1,000,000 (million) btc total, then we dump more Equation Group files, same quality, unencrypted, for free, to everyone. Q: When does auction end? A: Unknown. When we feel is time to end. Keep bidding until we announce winner. Q: Why I trust you? A: No trust, risk. You like reward, you take risk, maybe win, maybe not, no guarantees. There could be hack, steal, jail, dead, or war tomorrow. You worry more, protect self from other bidders, trolls, and haters. Closing Remarks - ————————————————– !!! Attention Wealthy Elites !!! We have final message for “Wealthy Elites”. We know what is wealthy but what is Elites? Elites is making laws protect self and friends, lie and fuck other peoples. Elites is breaking laws, regular peoples go to jail, life ruin, family ruin, but not Elites. Elites is breaking laws, many peoples know Elites guilty, Elites call top friends at law enforcement and government agencies, offer bribes, make promise future handjobs, (but no blowjobs). Elites top friends announce, no law broken, no crime commit. Reporters (not call journalist) make living say write only nice things about Elites, convince dumb cattle, is just politics, everything is awesome, check out our ads and our prostitutes. Then Elites runs for president. Why run for president when already control country like dictatorship? What this have do with fun Cyber Weapons Auction? We want make sure Wealthy Elite recognizes the danger cyber weapons, this message, our auction, poses to their wealth and control. Let us spell out for Elites. Your wealth and control depends on electronic data. You see what “Equation Group” can do. You see what cryptolockers and stuxnet can do. You see free files we give for free. You see attacks on banks and SWIFT in news. Maybe there is Equation Group version of cryptolocker+stuxnet for banks and financial systems? If Equation Group lose control of cyber weapons, who else lose or find cyber weapons? If electronic data go bye bye where leave Wealthy Elites? Maybe with dumb cattle? “Do you feel in charge?” Wealthy Elites, you send bitcoins, you bid in auction, maybe big advantage for you? bitmessage = BM-NBvAHfp5Y6wBykgbirVLndZtEFCYGht8 i2p-bote = o1uHOkOcMoFEa7O7dbEilzfMvWzo7bDu~td3x9gYz4b4t5OriJ7U6GUWr5GZoWxQ9f2TrIY5RzhpIMVP6hTLXZ END MESSAGE —–BEGIN PGP SIGNATURE—– Version: GnuPG v2 iQIcBAEBCAAGBQJXrr2sAAoJEAQSTyzLXAwbVzwP/jR5sQcS8VzH2jmuRjbE6RLV P3RkY6RWyyTyCtTiyTXK4RtWQoz8CfEjnXdIaR3BIZG4u827iI2fbQMVlWu0jMn4 NYN1I/neBoDaagApRgGQqYXip3IdHsqJennOAxRqr0ZoOgJ3IVtiZK8/6vtEnXRK 03IJvKu0zOVROuP0a9OPX0jko2g3Rl2tvo1ljkU1bqLKHs6xb1VzmdoqlAOYR1Bv 4Kb/Gbr6uc5fG84sM8FzSdiyJgS3U21SqfUENyFLyyP05iCyKCybFMne1JckFre8 gI/nUhdRHJaETYorY49PTQvdBaD30aT1I7efyAAM9uxsF97Au/UEvk0hkzh0YfoR /m+htNKlaP/oclL5GhJEq2O4wWb1KJuyrHU3FZYdUWRA4SlELBb0oR64cw/8kDo+ 6WftSANdlolgQLMbng2/ORGTeXHQ033mX6Op93o2oZUuNNhHvR1PnhWPUA2vMcIs ndo6YuYV2TZR/4GVNiJYQhTcWVNZ7a10FuvWk7yyHkTKXRVHG43G5Rzzm9ZxMUcL DMAExiPnrehGYTcxrrOP28RB+Mw7Is5YwRpc/h0mwDYGijjUzXGLXPWKFLa8ksxR zdaUnAjJzhVwR4IVGmGlU687Ox0FayJz9LAhst5eiittciY0iooz8YLee8hrxD7C XqUIpr4n+QKMYs4AfWd+ =5yni —–END PGP SIGNATURE—– • theshadowbrokers/EQGRP-AUCTION • EQGRP-Auction-Files.zip • Sync.com | Control Panel • EQGRP-Auction-Files.zip • app.box.com • mega.nz • Equation Group - Cyber Weapons Auction • Equation Group - Cyber Weapons Auctions

26 Mart 2016 Cumartesi

API Request Caching with JSON & PHP

When I began working with API’s a few year ago I was incredibly excited. The amount of data I had at my fingertips was overwhelming. I had the ability to create a full scale application with someone else’s data, and it was was mind boggling. Today I find myself using API’s in almost every project I am a part of. They have become a vital aspect of any modern website, and a vital skill for any modern web developer.

API Requests are Slow

When you work with an API you are accessing someone else’s information. This process is generally very slow and the more information you request, the slower it gets. You are often limited to the number of times you can request data from someone. This makes server-side caching an ideal solution to dramatically improve the speed of displaying API results.

How Much Faster

I was recently working with a pretty large request to the Indeed API. The response contained about 320 jobs, and took about 4-5 seconds each time. The following caching method cut the request time down to 0.08 seconds.

NOT CONVINCED?

The Caching Function

I’ve created this function to make it easy. It can easily be used with any API, just replace theindeed_api_request() function call.
/**
 * API Request Caching
 *
 *  Use server-side caching to store API request's as JSON at a set 
 *  interval, rather than each pageload.
 * 
 * @arg Argument description and usage info
 */
function json_cached_api_results( $cache_file = NULL, $expires = NULL ) {
    global $request_type, $purge_cache, $limit_reached, $request_limit;

    if( !$cache_file ) $cache_file = dirname(__FILE__) . '/api-cache.json';
    if( !$expires) $expires = time() - 2*60*60;

    if( !file_exists($cache_file) ) die("Cache file is missing: $cache_file");

    // Check that the file is older than the expire time and that it's not empty
    if ( filectime($cache_file) < $expires || file_get_contents($cache_file)  == '' || $purge_cache && intval($_SESSION['views']) <= $request_limit ) {

        // File is too old, refresh cache
        $api_results = indeed_api_request();
        $json_results = json_encode($api_results);

        // Remove cache file on error to avoid writing wrong xml
        if ( $api_results && $json_results )
            file_put_contents($cache_file, $json_results);
        else
            unlink($cache_file);
    } else {
        // Check for the number of purge cache requests to avoid abuse
        if( intval($_SESSION['views']) >= $request_limit ) 
            $limit_reached = " <span class='error'>Request limit reached ($request_limit). Please try purging the cache later.</span>";
        // Fetch cache
        $json_results = file_get_contents($cache_file);
        $request_type = 'JSON';
    }

    return json_decode($json_results);
}

HOW IT WORKS

The function takes two arguments:
  1. The $cache_file argument stores the server location of the cache file you wish to use. By default it will look for api-cache.json in the same directory as the script using this function.
  2. The $expires argument will store the time between each API request. By default a new API request will be made every 2 hours.
You’ll need to create the cache file with CHMOD 777 permissions before this function will work. The function will check to see if the cache file exists using file_exists(), throwing an error message if it does not. If the cache file exists, the script will check to see if it’s empty using file_get_contents(). If it is empty an initial API request is made and the results are stored as JSON in the cache file usingfile_put_contents(). If the cache file exists and is not empty the script will check the last time the file was modified using filectime(). If it was modified longer than the $expires time an API request is made and the file is updated.

Sample Indeed API Request

/**
 * Request jobs from Indeed API
 *
 * Split the request into smaller request chunks (25 results each)
 * and then consolidate them into a single array to meet the API
 * requirements.
 */
function indeed_api_request( $split = 50, $search = 'company:("Google")', $apikey = 'XXXXXXXXXXXXXXXX' ) {

    // Get the goods for making the API request to Indeed
    $search = urlencode($search);
    $split = intval($split);
    $user_agent = urlencode( $_SERVER['HTTP_USER_AGENT'] );
    $server_ip = filter_var( $_SERVER['SERVER_ADDR'], FILTER_VALIDATE_IP );

    // Split API request into multiple queries, requesting "$split" results per request
    $xmlrpc = "http://api.indeed.com/ads/apisearch?publisher=$apikey&q=$search&userip=$server_ip&useragent=$user_agent&v=2&limit=$split";
    $fullxml = simplexml_load_file( $xmlrpc );
    $totalresults = intval( $fullxml->totalresults );
    $loop_size = $totalresults / $split;
    $feeds = array();
    for ( $i = 0; $i <= $loop_size; $i++ ) {
        $offset = $split * $i;
        $feeds[] = ( $i === 0 ) ? $xmlrpc : "$xmlrpc&start=$offset";
    }

    // For each feed, store the results as an array
    $grouped_results = array();
    foreach ( $feeds as $feed ) {
        $xml = simplexml_load_file($feed);
        if( !$xml ) return false;
        $json = json_encode($xml);
        $grouped_results[] = json_decode($json, TRUE);
    }

    // Consolidate all grouped requests into a single, final results array
    $jobs = array();
    foreach ( $grouped_results as $job ) {
        $jobs = array_merge( (array) $jobs, (array) $job['results']['result'] );
    }

    return $jobs;
}
This is a function I commonly use to retrieve the results of an XML-RPC request from the Indeed API. I can further elaborate if anyone is interested, let me know using the comments below.

OUTPUT THE RESULTS AS HTML

I’ve used the function to display a nice HTML5 list of Indeed Jobs in this PHP, API & JSON caching demonstration.
/**
 * Format a basic job listing in HTML5
 */
function indeed_job_results( $api_results = NULL, $search = NULL ) {
    if( !$api_results ) return false;

    $total = count($api_results);
    $search = ( $search ) ? " found for &ldquo;<strong>$search</strong>&rdquo;" : "";

    $html = "<section class='jobs'>";
    $html .= "<header>";
    $html .= "<h2>$total jobs$search</h2>";
    $html .= "</header>";
    foreach ( $api_results as $job ) {
        $date = explode(' ', $job->date);
        $formattedDate = $date[2] . ' ' . $date[1] . ', ' . $date[3];

        $html .= "<article>";
        $html .= "<h3><a href='{$job->url}' target='_blank'>{$job->jobtitle}</a></h3>";
        $html .= "<p class='details'>{$job->formattedLocation} <em>&ndash;</em> $formattedDate</p>";
        $html .= "</article>";
    }
    $html .= "</section><!--// end .jobs -->";

    return $html;
}
Using the function in practice is simple.
$api_results = json_cached_api_results();
$jobs_output = indeed_job_results( $api_results, 'Google' );
The result is a nice HTML5 display.
<section class='jobs'>
    <header>
        <h2>650 jobs found for &ldquo;<strong>Google</strong>&rdquo;</h2>
    </header>

    <article>
        <h3><a href='http://www.indeed.com/viewjob?jk=caa97a24d40b837e&qd=TGbcPDy5GuwvL2ECGUPcRQVLz8qYsMKyox4VZPgZ7gXWjz26eFGVblZsapiU4aPT2U8gcWTUmEjcpOm0ZWfmQW51jR-X4A2GOFW7z-vRUlFe9tF3N6NENrAfMFkmRemu&indpubnum=5687187771681591&atk=16cgptih60k2g7vc' target='_blank'>Operations Technician (Temporary to Hire)</a></h3>
        <p class='details'>Lenoir, NC <em>&ndash;</em> Oct 20, 2011</p>
    </article>

    <article>
        <h3><a href='http://www.indeed.com/viewjob?jk=e4032e384764608b&qd=TGbcPDy5GuwvL2ECGUPcRQVLz8qYsMKyox4VZPgZ7gXWjz26eFGVblZsapiU4aPT2U8gcWTUmEjcpOm0ZWfmQW51jR-X4A2GOFW7z-vRUlFe9tF3N6NENrAfMFkmRemu&indpubnum=5687187771681591&atk=16cgptih60k2g7vc' target='_blank'>Administrative Assistant</a></h3>
        <p class='details'>New York, NY <em>&ndash;</em> Oct 20, 2011</p>
    </article>
</section><!--// end .jobs -->

In Conclusion

API’s provide access to incredibly amounts of data but it comes at a price. With speed and request limitations it’s important to have a solid method for caching your requests locally when working with an API’s in production. Hopefully this method helps you speed up your next API project!

Search Engine with PHP & Elasticsearch

Search Engine with PHP & Elasticsearch

https://www.youtube.com/watch?v=3xb1dHLg-Lk