Posts

Showing posts from October, 2015

Powershell - Send Email through GMail SMTP Server

I came across an instance where I had to send an email through Powershell.  This is the powershell script that I came up with and tested.

function sendMyEmail ($fromAddress, $toAddress, $subject, $body, $password) {     # The sendEmail function is setup to use a GMail STMP Server with a valid account         $SMTPServer = "smtp.gmail.com"     $SMTPClient = New-Object System.Net.Mail.SmtpClient     $SMTPClient.Host = 'smtp.gmail.com'     $SMTPClient.Port = 587     $SMTPClient.EnableSsl = $true     $SMTPClient.Credentials = New-Object System.Net.NetworkCredential($fromAddress, $password);     $SMTPClient.Send($fromAddress, $toAddress, $subject, $body) }
function gatherInfo {
}
#Main  $smtpInfo = New-Object PSObject -Property @{     fromAddress = $null     toAddress = $null     subject = $null     body = $null     password = $null } $smtpInfo.fromAddress = "myemail@gmail.com" $smtpInfo.toAddress = "mystuff@scriptkitty.work" $smtpInfo.subject = "…

nmap - Storing nmap Scan Information 1 File at a Time

The other day I was faced with a challenge where I needed to store each nmap scan as its own file. I created this quick python script to assist with doing this.
#!/usr/bin/python import sys import os import re scanFile = 'scan.list' def selectScan(nList, dList, sIP, eIP): file = open('scan.list', 'r') for line in file: if '#' not in line: theList = line.split(',') nList.append(theList[0]) dList.append(theList[1]) sIP.append(theList[2]) eIP.append(theList[3].strip()) file.close() print print "Select which scan you would like to perform:" print for i in range(0, len(nList)): print str(i+1) + ". Scan: " + nList[i] + ", Save to Directory: " + dList[i] + ", Start IP: " + sIP[i] + ", End IP: " + eIP[i] print scanSelect = raw_input('Select: ') try: scanSelect = int(scanSelect) scanSelect = scanSelect - 1 except: scanSelect = 9999 return scanSelect d…