What is it?
Operated by the Canadian Centre for Child Protection, Project Arachnid is an innovative tool to combat the growing proliferation of child sexual abuse material (CSAM) on the internet. The project was setup to scan the internet for CSAM and send takedown notice to concerned parties.
How does it work?
The service is hosted on AWS and capable of handling very high volume of traffic. The API scans for CSAM using MD5 hash database as well as use fuzzy image matching to detect images. When you submit the image list via API, the images get downloaded to their server instantly. Within next few mins you will receive an email if any content gets flagged.
How to get access to the API?
You can contact the team to request free access to the API https://projectarachnid.ca/en/contact/.
This is public initiative by the Canadian Centre for Child Protection and there is no fee or charge to use the API. However, API access is granted after reviewing your request to prevent abuse.
Script to send images to the API
Configure Cronjob to run every hour
Files attached.
To manually trigger the API open https://yoursite.com/api.php. If successful, the API will respond with URL list received and a custom ID.
PS: There is also option in API to wait for response. This could be useful if we could implement it like ModerateContent to stop the upload all together.
Operated by the Canadian Centre for Child Protection, Project Arachnid is an innovative tool to combat the growing proliferation of child sexual abuse material (CSAM) on the internet. The project was setup to scan the internet for CSAM and send takedown notice to concerned parties.
How does it work?
The service is hosted on AWS and capable of handling very high volume of traffic. The API scans for CSAM using MD5 hash database as well as use fuzzy image matching to detect images. When you submit the image list via API, the images get downloaded to their server instantly. Within next few mins you will receive an email if any content gets flagged.
How to get access to the API?
You can contact the team to request free access to the API https://projectarachnid.ca/en/contact/.
This is public initiative by the Canadian Centre for Child Protection and there is no fee or charge to use the API. However, API access is granted after reviewing your request to prevent abuse.
Script to send images to the API
PHP:
<?php
set_time_limit(1000);
include('dbconnectfile.php'); //Your database config file
date_default_timezone_set('GMT+0'); // Your time zone
$time=date('Y-m-d H:i:s');
$ptime=date('Y-m-d H:i:s',strtotime('-61 minutes')); //Time invertal to retrive image list. This should match your Cron job interval.
$result = mysqli_query($link,"SELECT * FROM images where image_date_gmt > '$ptime'"); //Retrives all images uploaded after last check.
echo '<h2>Mod time '.$time.'</h2>'; //Output current time
$post= '[';
if (mysqli_num_rows($result)>0){
while($r=mysqli_fetch_array($result))
{
$imagename=$r["image_name"];
$imagex=$r["image_extension"];
$storid=$r["image_storage_id"];
$imgurl='https://s'.$storid.'.yoursite.com/images/'.$imagename.'.'.$imagex.''; //Rebuild to your image direct URL. If you don't use external storage ignore $storid
$curl = curl_init();
$post = $post .'{ "url": "'.$imgurl.'" },';
}
}
$post= $post .'{ "url": "'.$imgurl.'" } ]';
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.arachnid.c3p.ca/api/crawls/{crawl parameter}/multiple-links", //Set your crwal parameter
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 200,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $post,
CURLOPT_HTTPHEADER => array(
"Content-Type: application/json", "Authorization: {Your API Key}"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
echo '<h2>End time '.$ptime.'</h2>'; //End time to indicate time interval of images retrived
//Email alert in case the API failed
if ($err) {
echo "cURL Error #:" . $err;
$email = "username@gmail.com";
$content = $err;
$name = "Alert";
$sender = "alert@yourdomain.com";
$subject = "Alert: API failed";
$headers = "From: $name "."<".$sender.">\r\n";
mail($email, $subject, $content, $headers );
} else {
echo $response;
}
?>
PHP:
<?php
$link = mysqli_connect("localhost:3306", "username", "password", "databasename"); //your database server details
if (!$link) {
echo "Error: Unable to connect to MySQL." . PHP_EOL;
echo "Debugging errno: " . mysqli_connect_errno() . PHP_EOL;
echo "Debugging error: " . mysqli_connect_error() . PHP_EOL;
exit;
}
mysqli_select_db($link, 'databasename') or die("Could not open the db 'databasename'");
?>
Configure Cronjob to run every hour
Code:
0 * * * * /usr/bin/php /var/www/html/api.php
Files attached.
To manually trigger the API open https://yoursite.com/api.php. If successful, the API will respond with URL list received and a custom ID.
PS: There is also option in API to wait for response. This could be useful if we could implement it like ModerateContent to stop the upload all together.
Attachments
Last edited: