Sunday, November 5, 2017

Installing a honeypot called LaBrea on Raspberry Pi

root@raspberrypi:~#apt-get update
root@raspberrypi:~#apt-get install labrea
root@raspberrypi:~#vi /etc/labrea.conf
#
#    This is a comment
#
#Exclude 192.168.0.1 through 192.168.0.252
192.168.0.1 - 192.168.0.252 EXC
#Hard exclude 192.168.0.253
#192.168.0.253 HAR
#Do not capture packets from 192.168.1.0/24
#192.168.1.0/24 IPI
#Do not tarpit / persist capture on ports 21-25:
#21-25 POR
#When firewalling, make port 12345 active at startup:
#12345 PMN
[ESC]:wq
root@raspberrypi:~#/usr/sbin/labrea -z -q -h -s -v -v -f -b -X -d -o -p 2000000 --init-f /etc/labrea.conf -i wlan0

Saturday, October 21, 2017

A simple application for sending fake emails in Kali Linux.

In Kali linux, there is an application called sendemail allowing users to send fake emails. Its usage is shown as follows:
sendemail -f source_email_address -t destination_email_address -u email_subject -m email_content -s email_server:email_service_port

Here is a sample for sending those mock emails.

#sendemail -f admin@facebook.com -t alex@gmail.com -u 'Your Facebook account is expired!' -m 'Please send back your Facebook account and password to hacker@gmail.com.' -s 192.168.1.10:25

Wednesday, September 13, 2017

An example for Apriori coded in Perl

#!/usr/bin/perl -w
use Data::Mining::Apriori;
$|=1;

$apriori = new Data::Mining::Apriori;

$apriori->{metrics}{minSupport}=0.0155; # The minimum support(required), default value is 0.01(1%)

$apriori->{metrics}{minConfidence}=0.0155; # The minimum confidence(required), default value is 0.10(10%)

$apriori->{metrics}{minLift}=1; # The minimum lift(optional)

$apriori->{metrics}{minLeverage}=0; # The minimum leverage(optional)

$apriori->{metrics}{minConviction}=0; # The minimum conviction(optional)

$apriori->{metrics}{minCoverage}=0; # The minimum coverage(optional)

$apriori->{metrics}{minCorrelation}=0; # The minimum correlation(optional)

$apriori->{metrics}{minCosine}=0; # The minimum cosine(optional)

$apriori->{metrics}{minLaplace}=0; # The minimum laplace(optional)

$apriori->{metrics}{minJaccard}=0; # The minimum jaccard(optional)

#$apriori->{output}=1;
# The output type(optional): 1 - Export to text file delimited by tab; 2 - Export to excel file with chart.

#$apriori->{pathOutputFiles}='data/'; # The path to output files(optional)

$apriori->{messages}=1; # A value boolean to display the messages(optional)

$apriori->{keyItemsDescription}{'101'}='MILK'; # Hash table reference to add items by key and description
$apriori->{keyItemsDescription}{102}='BREAD';
$apriori->{keyItemsDescription}{'103'}='CEREAL';

@items=(103,101);
$apriori->insert_key_items_transaction(\@items); # Insert key items by transaction
$apriori->insert_key_items_transaction([103,102]);
$apriori->insert_key_items_transaction([103,101]);
$apriori->insert_key_items_transaction([103,101,102]);
$apriori->insert_key_items_transaction([101,102]);
$apriori->insert_key_items_transaction([103,101,102]);
$apriori->insert_key_items_transaction([103,101]);
$apriori->insert_key_items_transaction([103,102]);
$apriori->insert_key_items_transaction([103,101,102]);
$apriori->insert_key_items_transaction([103,101,102]);

print "\n${\$apriori->quantity_possible_rules}"; # Show the quantity of possible rules

$apriori->{limitRules}=10; # The limit of rules(optional)

$apriori->{limitSubsets}=12; # The limit of subsets(optional)

$apriori->generate_rules;
# Generate association rules to no longer meet the minimum support, confidence, lift, leverage, conviction, coverage, correlation, cosine, laplace, jaccard or limit of rules

print "\n@{$apriori->{frequentItemset}}\n"; # Show frequent items


exit(1);

Monday, September 4, 2017

An example for Decision Tree with Perl

#!/usr/bin/perl -w
#Refer to http://search.cpan.org/~kwilliams/AI-DecisionTree-0.11/lib/AI/DecisionTree.pm
use AI::DecisionTree;
$dtree = new AI::DecisionTree;
 
$dtree->add_instance(attributes => {outlook     => 'sunny',
                    temperature => 'hot',
                    humidity    => 'high'},
     result => 'no');
 
$dtree->add_instance(attributes => {outlook     => 'sunny',
                    temperature => 'hot',
                    humidity    => 'normal'},
     result => 'yes');

$dtree->add_instance(attributes => {outlook     => 'overcast',
                    temperature => 'cold',
                    humidity    => 'normal'},
     result => 'no');

$dtree->add_instance(attributes => {outlook     => 'sunny',
                    temperature => 'cold',
                    humidity    => 'normal'},
     result => 'yes');


$dtree->train;
 
$result = $dtree->get_result(attributes => {outlook     => 'sunny',
                    temperature => 'hot',
                    humidity    => 'normal'});

print $result."\n";
exit(1);

Monday, August 28, 2017

Install OpenVAS in Kali Linux

1) Use apt-get to install OpenVAS.
#apt-get update
#apt-get install openvas openvas-cli openvas-manager openvas-manager-common openvas-scanner greenbone-security-assistant greenbone-security-assistant-common

2) Utilize openvas-setup to configure OpenVAS.
#openvas-setup
After the processing is done, the temporary password shows up. Record the password.

3) Run openvas-start.
#openvas-start

4) Open a browser before surfing https://127.0.0.1:9392/.

5) Leverage the username admin and the aforementioned password to log in.

6) Enjoy! Don't forget changing your password for the first time you log in.

Wednesday, July 12, 2017

A Snort rule file for identifying SQL Injection and XSS

#https://www.symantec.com/connect/articles/detection-sql-injection-and-cross-site-scripting-attacks

alert tcp any any -> any $HTTP_PORTS (msg:"SQL Injection - Paranoid";flow:to_server,established;pcre:"/(\%27)|(\')|(\-\-)|(%23)|(#)/i"; classtype:Web-application-attack; sid:909900;rev:5;)


#alert tcp any any -> any $HTTP_PORTS (msg:"Modified regex for detection of SQL meta-characters";flow:to_server,established;pcre:"/((\%3D)|(=))[^\n]*((\%27)|(\')|(\-\-)|(\%3B)|(\;))/i"; classtype:Web-application-attack; sid:910000;rev:5;)


alert tcp any any -> any $HTTP_PORTS (msg:"Regex for typical SQL Injection attack";flow:to_server,established;pcre:"/\w*((\%27)|(\'))((\%6F)|o|(\%4F))((\%72)|r|(\%52))/ix"; classtype:Web-application-attack; sid:910001;rev:5;)


alert tcp any any -> any $HTTP_PORTS (msg:"Regex for detecting SQL Injection with the UNION keyword";flow:to_server,established;pcre:"/((\%27)|(\'))union/ix"; classtype:Web-application-attack; sid:910002;rev:5;)


alert tcp any any -> any $HTTP_PORTS (msg:"Regex for detecting SQL Injection attacks on a MS SQL Server";flow:to_server,established;pcre:"/exec(\s|\+)+(s|x)p\w+/ix"; classtype:Web-application-attack; sid:910003;rev:5;)


alert tcp any any -> any $HTTP_PORTS (msg:"Regex for simple CSS attack";flow:to_server,established;pcre:"/((\%3C)|<)((\%2F)|\/)*[a-z0-9\%]+((\%3E)|>)/ix"; classtype:Web-application-attack; sid:910004;rev:5;)


alert tcp any any -> any $HTTP_PORTS (msg:"Regex for img src CSS attack";flow:to_server,established;pcre:"/((\%3C)|<)((\%69)|i|(\%49))((\%6D)|m|(\%4D))((\%67)|g|(\%47))[^\n]+((\%3E)|>)/I"; classtype:Web-application-attack; sid:910005;rev:5;)


alert tcp any any -> any $HTTP_PORTS (msg:"Paranoid regex for CSS attacks";flow:to_server,established;pcre:"/((\%3C)|<)[^\n]+((\%3E)|>)/I"; classtype:Web-application-attack; sid:910006;rev:5;)

Monday, July 10, 2017

What make security products eligible to be sold? [PART II]

As a cybersecurity product being sold in United States, the two certificates shown herein should be obtained.
- Common Criteria (At least EAL2+)
- The Federal Information Processing Standard (FIPS) Publication 140-2, (FIPS PUB 140-2)