Showing posts from October, 2016

Powershell - Scripts to Download and Save a File AND POST Data to a Web Page

Recently I created a couple of simple Powershell scripts to download and save a file and then send a POST Request to a Site.  Below are the scripts that I created.

$wc = New-Object System.Net.WebClient $wc.Headers.Add("User-Agent","IE6")        $wc.Proxy = [System.Net.WebRequest]::DefaultWebProxy $wc.Proxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials $response = $wc.DownloadString("") Set-Content -Value $response -Path $env:APPDATA\Microsoft\output.txt
$url = "" $encodedData = "b3V0Ym91bmQ%3d"
$params = New-Object System.Collections.Specialized.NameValueCollection $params.Add('poster','blah55') $params.Add('syntax','text') $params.Add('content',$encodedData)
$wc = New-Object System.Net.WebClient $wc.Headers.Add("User-Agent","IE6")        $wc.Proxy = [System.Net.WebRequest]::DefaultWebProxy $wc.Proxy.Credent…

VBA - Script to Download a file from a URL

Below is a Visual Basic for Applications script I quickly build to download a file through a Macro to the computer.  This was to test the capability of being able to do it and finding a way to prevent it from occurring.

Sub dFile() ' ' vTest Macro ' ' Dim myURL As String dURL = "http://blah/"
Dim WinHttpReq As Object Dim fileName As String
fileName = Environ("AppData") & "\microsoft\" Set WinHttpReq = CreateObject("Microsoft.XMLHTTP") WinHttpReq.Open "GET", dURL WinHttpReq.send
If WinHttpReq.Status = 200 Then     Set oStream = CreateObject("ADODB.Stream")     oStream.Open     oStream.Type = 1     oStream.Write WinHttpReq.responseBody     oStream.SaveToFile fileName, 2     oStream.Close End If
End Sub

Python - Script to Send an Email through Gmail

Below is a python script that I was using to send an email through a gmail account:


import smtplib


msg='To another email address.'

password='specific use password'

server = smtplib.SMTP('')
server.login(username, password)
server.sendmail(fromAddress, toAddress, msg)

iptables - Setup for a home router with 3 vlans

I began to create a home router with 2 NICs.  The first NIC is for the WAN and then the second NIC is for the LAN.  The LAN NIC is then split up with 3 vlans.  The vlans are serving the purposes of the first being for a Wireless LAN, second being the Wired LAN and the third being an Untrusted Network for testing and whatever else.  The NIC does plug into a switch that is then VLANed respectively also.  My purpose of posting it is to show how it could be done and understand it is probably not without bugs.
The main reason I am creating the 3 vlans is to separate out and monitor the IoT devices that are starting to accumulate in my house and separate my testing lab from everything else due to the malware that I sometimes will detonate in it.

Below is the configuration of the /etc/network/interfaces file to establish the vlans.  After that configuration is what I started with to built out iptables for each environment.  I am also running a caching bind9 server and plan to setup squid for…