This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
account_list = ["GiuseppeConteIT","luigidimaio","nzingaretti","matteorenzi","GiorgiaMeloni","matteosalvinimi","CarloCalenda","berlusconi","civati"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
consumer_key = 'INSERT YOUR KEY HERE' | |
consumer_secret = 'INSERT YOUR SECRET HERE' | |
access_token = 'INSERT YOUR ACCESS TOKEN HERE' | |
access_secret = 'INSERT YOUR ACCESS SECRET HERE' | |
auth = OAuthHandler(consumer_key, consumer_secret) | |
auth.set_access_token(access_token, access_secret) | |
api = tweepy.API(auth, wait_on_rate_limit=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime, date, time, timedelta | |
import pymysql | |
import tweepy | |
from tweepy import OAuthHandler | |
from collections import Counter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function exists_email($email) { | |
if (!isset($email)) { | |
return true; | |
} | |
try { | |
$query = $this->db->prepare("SELECT id FROM subscribers WHERE email_hash=?"); | |
$data = Array($email); | |
$query->execute($data); | |
$all_mails = $query->fetchAll(); | |
foreach($all_mails as $row) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// check if mail already exists | |
$email_hash = $dao->getBlindIndex($email); | |
if ($dao->exists_email($email_hash)) { | |
header("location: index.php?e=email_exists"); | |
exit(); | |
} | |
// check if phone already exists | |
$phone_hash = $dao->getBlindIndex($phone); | |
if ($dao->exists_phone($phone_hash)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="skills"> | |
<ul class="lines"> | |
<li class="line l--0"> | |
<span class="line__label title"> | |
Skill level: | |
</span> | |
</li> | |
<li class="line l--25"> | |
<span class="line__label"> | |
The basics |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<td> | |
<span class="moreinfo" data-toggle="tooltip" title="string stored in database:<?php echo $row['email'];?>"> | |
<?php echo $dao->dec($row['email']);?> | |
</span> | |
</td> | |
<td> | |
<span class="moreinfo" data-toggle="tooltip" title="string stored in database: <?php echo $row['phone'];?>"> | |
<?php echo $dao->dec($row['phone']);?> | |
</span> | |
</td> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function dec($string) { | |
$decoded = base64_decode($string); | |
$key = base64_decode($this->key); | |
$nonce = mb_substr($decoded, 0, SODIUM_CRYPTO_SECRETBOX_NONCEBYTES, '8bit'); | |
$ciphertext = mb_substr($decoded, SODIUM_CRYPTO_SECRETBOX_NONCEBYTES, null, '8bit'); | |
try { | |
$plaintext = sodium_crypto_secretbox_open($ciphertext, $nonce, $key); | |
return $plaintext; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function insert($first_name,$last_name,$email,$phone,$privacy,$source,$ip) { | |
if ($first_name.''=='' || $last_name.'' == '' || $email.'' == '' || $phone.'' == '' || $privacy.'' == '') { | |
return false; | |
} | |
else { | |
// create blind index for encrypted searchable fields | |
$email_hash = $this->getBlindIndex($email); | |
$phone_hash = $this->getBlindIndex($phone); | |
// get key for encryption |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function getBlindIndex($string) | |
{ | |
$index_key = base64_decode($this->index_key); | |
return bin2hex( | |
sodium_crypto_pwhash( | |
32, | |
$string, | |
$index_key, | |
SODIUM_CRYPTO_PWHASH_OPSLIMIT_MODERATE, |