Merge branch 'master' of github.com:ChrisTruncer/Egress-Assess

master
Chris Truncer 2017-08-31 15:24:30 -06:00
commit 62ab4d30cd
3 changed files with 148 additions and 5 deletions

View File

@ -250,6 +250,49 @@ function Invoke-EgressAssess
$script:AllSSN = $list.ToArray() $script:AllSSN = $list.ToArray()
} }
function Generate-NI
{
$script:AllNI = @()
#determine the number of NI based on 9 bytes per NI
$num = [math]::Round(($Size * 1MB)/9)
Write-Verbose "Generating $Size MB of National Insurance Numbers ($num)..."
$list = New-Object System.Collections.Generic.List[System.String]
for ($i = 0; $i -lt $num; $i++)
{
if ($Fast)
{
$randString = -join ((65..90) | Get-Random -Count 3 | % {[char]$_})
$randNum = Get-Random -minimum 100 -maximum 1000
$randNumString = [string][int64]$randNum
$randNiBase = "$($randString.substring(0,2))$($randNum)"
$randNiEnd = Get-Random -minimum 100 -maximum 500
for ($i2 = $randNiEnd; $i2 -lt $($randNiEnd+500); $i2++)
{
$randNI = "$randNiBase$i2$($randString.substring(2))"
$list.Add($randNI)
$i++
}
}
else
{
$randString = -join ((65..90) | Get-Random -Count 3 | % {[char]$_})
$randNum = Get-Random -minimum 100000000000 -maximum 1000000000000
$randNumString = [string][int64]$randNum
$r = "$($randString.substring(0,2))$($randNumString.substring(0,6))$($randString.substring(2))"
$list.Add($r)
$r = "$($randString.substring(0,2))$($randNumString.substring(6,6))$($randString.substring(2))"
$list.Add($r)
$i++
}
}
$script:AllNI = $list.ToArray()
}
function Generate-CreditCards function Generate-CreditCards
{ {
@ -471,6 +514,11 @@ function Invoke-EgressAssess
Generate-SSN Generate-SSN
$Data = $AllSSN $Data = $AllSSN
} }
elseif ($Datatype -eq "ni")
{
Generate-NI
$Data = $AllNI
}
elseif ($Datatype -eq "cc") elseif ($Datatype -eq "cc")
{ {
Generate-CreditCards Generate-CreditCards
@ -618,6 +666,11 @@ function Invoke-EgressAssess
Generate-SSN Generate-SSN
$Data = $AllSSN $Data = $AllSSN
} }
elseif ($Datatype -eq "ni")
{
Generate-NI
$Data = $AllNI
}
elseif ($Datatype -eq "cc") elseif ($Datatype -eq "cc")
{ {
Generate-CreditCards Generate-CreditCards
@ -907,6 +960,11 @@ function Invoke-EgressAssess
Generate-SSN Generate-SSN
$Data = $AllSSN $Data = $AllSSN
} }
elseif ($Datatype -eq "ni")
{
Generate-NI
$Data = $AllNI
}
elseif ($Datatype -eq "cc") elseif ($Datatype -eq "cc")
{ {
Generate-CreditCards Generate-CreditCards
@ -1013,6 +1071,11 @@ function Invoke-EgressAssess
Generate-SSN Generate-SSN
$Data = $AllSSN $Data = $AllSSN
} }
elseif ($Datatype -eq "ni")
{
Generate-NI
$Data = $AllNI
}
elseif ($Datatype -eq "cc") elseif ($Datatype -eq "cc")
{ {
Generate-CreditCards Generate-CreditCards
@ -1153,6 +1216,11 @@ function Invoke-EgressAssess
Generate-SSN Generate-SSN
$Data = $AllSSN $Data = $AllSSN
} }
elseif ($Datatype -eq "ni")
{
Generate-NI
$Data = $AllNI
}
elseif ($Datatype -eq "cc") elseif ($Datatype -eq "cc")
{ {
Generate-CreditCards Generate-CreditCards
@ -1260,6 +1328,11 @@ function Invoke-EgressAssess
Generate-SSN Generate-SSN
$FTPData = $AllSSN $FTPData = $AllSSN
} }
elseif ($Datatype -eq "ni")
{
Generate-NI
$FTPData = $AllNI
}
elseif ($Datatype -eq "cc") elseif ($Datatype -eq "cc")
{ {
Generate-CreditCards Generate-CreditCards
@ -1351,6 +1424,11 @@ function Invoke-EgressAssess
Generate-SSN Generate-SSN
$FTPData = $AllSSN $FTPData = $AllSSN
} }
elseif ($Datatype -eq "ni")
{
Generate-NI
$FTPData = $AllNI
}
elseif ($Datatype -eq "cc") elseif ($Datatype -eq "cc")
{ {
Generate-CreditCards Generate-CreditCards
@ -1473,6 +1551,11 @@ function Invoke-EgressAssess
Generate-SSN Generate-SSN
$SMTPData = $AllSSN $SMTPData = $AllSSN
} }
elseif ($Datatype -eq "ni")
{
Generate-NI
$SMTPData = $AllNI
}
elseif ($Datatype -eq "cc") elseif ($Datatype -eq "cc")
{ {
Generate-CreditCards Generate-CreditCards
@ -1531,6 +1614,11 @@ function Invoke-EgressAssess
Generate-SSN Generate-SSN
[string]$ICMPData = $AllSSN [string]$ICMPData = $AllSSN
} }
elseif ($Datatype -eq "ni")
{
Generate-NI
[string]$ICMPData = $AllNI
}
elseif ($Datatype -eq "cc") elseif ($Datatype -eq "cc")
{ {
Generate-CreditCards Generate-CreditCards
@ -1651,6 +1739,11 @@ function Invoke-EgressAssess
Generate-SSN Generate-SSN
[string]$DNSData = $AllSSN [string]$DNSData = $AllSSN
} }
elseif ($Datatype -eq "ni")
{
Generate-NI
[string]$DNSData = $AllNI
}
elseif ($Datatype -eq "cc") elseif ($Datatype -eq "cc")
{ {
Generate-CreditCards Generate-CreditCards
@ -1734,6 +1827,11 @@ function Invoke-EgressAssess
Generate-SSN Generate-SSN
[string]$DNSData = $AllSSN [string]$DNSData = $AllSSN
} }
elseif ($Datatype -eq "ni")
{
Generate-NI
[string]$DNSData = $AllNI
}
elseif ($Datatype -eq "cc") elseif ($Datatype -eq "cc")
{ {
Generate-CreditCards Generate-CreditCards
@ -1793,6 +1891,11 @@ function Invoke-EgressAssess
Generate-CreditCards Generate-CreditCards
[string]$SMBData = $AllCC [string]$SMBData = $AllCC
} }
elseif ($Datatype -eq "ni")
{
Generate-NI
[string]$SMBData = $AllNI
}
elseif ($Datatype -eq "ssn") elseif ($Datatype -eq "ssn")
{ {
Generate-SSN Generate-SSN

View File

@ -11,7 +11,7 @@ To setup, run the included setup script, or perform the following:
1. Install pyftpdlib 1. Install pyftpdlib
2. Generate a server certificate and store it as "server.pem" on the same level as Egress-Assess. This can be done with the following command: 2. Generate a server certificate and store it as "server.pem" on the same level as Egress-Assess. This can be done with the following command:
"openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes" `openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes`
Usage Usage
@ -26,16 +26,16 @@ Typical use case for Egress-Assess is to copy this tool in two locations. One l
To extract data over FTP, you would first start Egress-Assesss FTP server by selecting “--server ftp” and providing a username and password to use: To extract data over FTP, you would first start Egress-Assesss FTP server by selecting “--server ftp” and providing a username and password to use:
./Egress-Assess.py --server ftp --username testuser --password pass123 `./Egress-Assess.py --server ftp --username testuser --password pass123`
Now, to have the client connect and send data to the ftp server, you could run... Now, to have the client connect and send data to the ftp server, you could run...
./Egress-Assess.py --client ftp --username testuser --password pass123 --ip 192.168.63.149 --datatype ssn `./Egress-Assess.py --client ftp --username testuser --password pass123 --ip 192.168.63.149 --datatype ssn`
Also, you can setup Egress-Assess to act as a web server by running.... Also, you can setup Egress-Assess to act as a web server by running....
./Egress-Assess.py --server https `./Egress-Assess.py --server https`
Then, to send data to the FTP server, and to specifically send 15 megs of credit card data, run the following command... Then, to send data to the FTP server, and to specifically send 15 megs of credit card data, run the following command...
./Egress-Assess.py --client https --data-size 15 --ip 192.168.63.149 --datatype cc `./Egress-Assess.py --client https --data-size 15 --ip 192.168.63.149 --datatype cc`

40
datatypes/ni_numbers.py Normal file
View File

@ -0,0 +1,40 @@
'''
This module generates UK National Insurance Numbers.
Format is 2 prefix letters, 6 digits, 1 suffix letter:
AB123456C
They are sometimes printed with spaces:
AB 12 34 56 C
This modules doesn't take correct letter prefixing into account,
it just generates them randomly. But this is probably good
enough for basic regex-type filters to detect.
'''
from common import helpers
class Datatype:
def __init__(self, cli_object):
self.cli = "ni"
self.description = "UK National Insurance Numbers"
self.filetype = "text"
self.datasize = int(cli_object.data_size)
def create_ni(self):
ni_n = helpers.randomNumbers(6)
ni_s = (helpers.randomString(3)).upper()
ni = ni_s[0:2] + ni_n[0:6] + ni_s[2:3]
return ni
def generate_data(self):
print "[*] Generating data..."
nis = ''
# This is approx 1 meg of ni's (not including ", ")
for single_ni in range(0, 100000 * self.datasize):
nis += self.create_ni() + ', '
return nis