Ubuntu/Scripts

From r00tedvw.com wiki
Revision as of 00:12, 22 June 2014 by R00t (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Email current IP address

#!/bin/bash -x

#define varibles
#HOSTNAME=`hostname`
from="$HOSTNAME"'@sender domain.com'
to='recipient address'
recipient_mx='recipient mail exchanger'
DATE=`date`
messageid='[email protected]'
IP=$(curl checkip.dyndns.org|awk '/Address:/ {print$6}'|sed 's/<.*/ /')

#function containing mail commands.  Contains enough RFC required fields to satisfy gmail's requirements to allow the message, though it may be detected as spam if you do not have a SPF record.
function mail_input {
        sleep 1
        echo 'ehlo test.com\n'
        sleep 0.5
        printf 'mail from:<'"$from"'>\n'
        sleep 1
        printf 'rcpt to:<'"$to"'>\n'
        sleep 1
        printf 'data\n'
        sleep 0.5
        printf 'Return-Path: <'"$from"'>\n'
        printf 'Date: '"$DATE"'\n'
        printf 'Message-ID: <'"$messageid"'>\n'
        printf 'Subject: test\n'
        printf 'From: <'"$from"'>\n'
        printf 'To: <'"$to"'>\n'
        printf "$HOSTNAME"' ip address= '"$IP"'\n'
        printf '.\n'
        printf 'quit'
}

#sending mail with mail_input function
mail_input | telnet $recipient_mx 25 || exit
exit
Personal tools
Namespaces

Variants
Actions
Navigation
Mediawiki
Confluence
DevOps Tools
Ubuntu
Ubuntu 22
Mac OSX
Oracle Linux
AWS
Windows
OpenVPN
Grafana
InfluxDB2
TrueNas
OwnCloud
Pivotal
osTicket
OTRS
phpBB
WordPress
VmWare ESXI 5.1
Crypto currencies
HTML
CSS
Python
Java Script
PHP
Raspberry Pi
Canvas LMS
Kaltura Media Server
Plex Media Server
MetaSploit
Zoneminder
ShinobiCE
Photoshop CS2
Fortinet
Uploaded
Certifications
General Info
Games
Meal Plans
NC Statutes
2020 Election
Volkswagen
Covid
NCDMV
Toolbox