Threat Level: green Handler on Duty: Brad Duncan

SANS ISC: Querying the DShield API from RTIR SANS ISC InfoSec Forums

Participate: Learn more about our honeypot network

Sign Up for Free!   Forgot Password?
Log In or Sign Up for Free!
Querying the DShield API from RTIR

A few days ago, Tom wrote a diary(1) about RTIR(2) and its REST API. He explained how the tool can be fulfilled with external data. Being a DShield contributor for years (I submit my firewall logs), I like to search for IP addresses information in the DShield database. By default, RTIR extracts IP addresses from tickets and has an interface to query services like WHOIS servers, to perform a traceroute or to query any third-party website. RTIR being extremely configurable, why not extend it to query the DShield database using the ISC API(3)!

If IP addresses can be queried via the URL "", don't do this. First of all for performance reasons but the page cannot be displayed in an iframe (that's the case in RTIR) because it sets the 'X-Frame-Options' to 'SAMEORIGIN'. To query details of an IP address, use the following IP API call:

Results are returned in XML. To integrate DShield lookups into RTIR, follow this procedure.

1. Create a new page called "isc_ipinfo.php" in your Apache server running RTIR (or any available HTTP server). This page will receive the IP address, query the DShield API and reformat (basically) the XML output:

$ip = $_GET['ip'];
if (!filter_var($ip, FILTER_VALIDATE_IP)) {
        echo "Invalid IP address!";
$d = simplexml_load_file(''.$ip);
<tr><td align="right"><b>IP Address:</b></td><td><?php echo $d->ip; ?>(<a href="<?php echo $ip ?>" target="_blank">Details</a>)</td></tr>
<tr><td align="right"><b>Network:</b></td><td><?php echo $d->network; ?></td></tr>
<tr><td align="right"><b>AS:</b></td><td><?php echo $d->as; ?></td></tr>
<tr><td align="right"><b>AS Name:</b></td><td><?php echo $d->asname; ?></td></tr>
<tr><td align="right"><b>AS Size:</b></td><td><?php echo $d->assize; ?></td></tr>
<tr><td align="right"><b>Country:</b></td><td><?php echo $d->country; ?></td></tr>
<tr><td align="right"><b>Count:</b></td><td><?php echo $d->count; ?></td></tr>
<tr><td align="right"><b>Attacks:</b></td><td><?php echo $d->attacks; ?></td></tr>
<tr><td align="right"><b>Min Date:</b></td><td><?php echo $d->mindate; ?></td></tr>
<tr><td align="right"><b>Max Date:</b></td><td><?php echo $d->maxdate; ?></td></tr>
<tr><td align="right"><b>Last Updated:</b></td><td><?php echo $d->lastupdated; ?></td></tr>
<tr><td align="right"><b>Abuse Contact:</b></td><td><?php echo $d->asabusecontact; ?></td></tr>
<tr><td align="right"><b>Comment:</b></td><td><?php echo $d->comment; ?></td></tr>

2. Edit your $RTIRHOME/etc/ and add the new service in $RTIRIframeResearchToolConfig (pointing to your URL):

Set($RTIRIframeResearchToolConfig, {
    1 => { FriendlyName => 'SANS ISC IP Info', URL => 'http://xxxxxxxx/isc_ipinfo.php?ip=__SearchTerm__' },
    3 => { FriendlyName => 'Google', URL => '' },
    4 => { FriendlyName => 'CVE', URL => ''},
    5 => { FriendlyName => '', URL => ''},
    6 => { FriendlyName => 'McAfee SiteAdvisor', URL => ''},
    7 => { FriendlyName => 'BFK DNS Logger', URL => ''}
} );

3. Restart your RTIR instance and enjoy! You can now query the DShield API:

It's also easy to create new "portlets" to be used in dashboards. As a bonus, let's display the ISC Infocon status in a RTIR dashboard. 

1. Create the new portlet in $RTIRHOME/local/html/Elements. Let's call it "InfoconStatus":

<&|/Widgets/TitleBox, title => loc('SANS ISC Status')&>
                <img src="" alt="SANS ISC Infocon Status">

2. Enable the new portlet in $RTIRHOME/etc/

Set(@RTIR_HomepageComponents, qw(

3. Restart your RTIR instance and adapt your favorite dashboards:


Xavier Mertens
ISC Handler - Freelance Security Consultant

I will be teaching next: Reverse-Engineering Malware: Malware Analysis Tools and Techniques - SANS Threat Hunting London 2022


650 Posts
ISC Handler
Sep 3rd 2015
Some addresses gives confusing results:
<updated>2015-09-04 04:02:47</updated>
<asname>GIGAINFRA Softbank BB Corp.</asname>

<![CDATA[ LEVEL3 - Level 3 Communications, Inc. ]]>
Povl H.

77 Posts
I don't know why RFC1912 and loopback IP addresses are in the DShield DB indeed.
On the other side, it's not relevant to query information about them.

650 Posts
ISC Handler
I fixed the badly identified RFC 1918 addresses. The issue was that if an IP was not routed, the closest (but smaller) routable IP address space was shown. Should be fixed now. You may still see cached data for a bit.

As for importing RFC1918 networks: I recently stopped doing it. I was a bit conflicted about it. In some ways, I want to import the data "as received", and people do send RFC1918 traffic. But since this is most likely internal data that should not have been sent, I stopped importing it. Old data will be kept for now.

4306 Posts
ISC Handler
Would be nice to do it also for other systems such as MISP... :)
David Andre aka Elhoim

4 Posts
Indeed, I added this in my todo/wishlist.

650 Posts
ISC Handler

Sign Up for Free or Log In to start participating in the conversation!