Overclock.net › Forums › Software, Programming and Coding › Operating Systems › Linux, Unix › Share your Scripts
New Posts  All Forums:Forum Nav:

Share your Scripts - Page 25

post #241 of 305
First of all, sry for my English level...

This is a simple script to launch on startup or whenever you want, to change your MAC automatically for another randomly known one...

I recomend to put on startup scripts... so everytime you restart your machine, your MAC will be changed...

If set on startup, It's really usefull for pentesters...

If you have a wifi with mac filter, then this can cause some connection troubles... XD

Note that interface wlan0 may change depending on the system... Use your own...
Note that needs macchanger installed on system...
Code:
sudo ifconfig wlan0 down
sudo macchanger -A wlan0
sudo ifconfig wlan0 up

Note that needs to create some rules on suddoers file to not ask for password...
To add thir rule, launch:

$ sudo visudo

and add:
Code:
user host = (root) NOPASSWD:  /sbin/ifconfig/wlan0 down
user host = (root) NOPASSWD:  /sbin/ifconfig/wlan0 up
user host = (root) NOPASSWD:  /usr/bin/macchanger -A wlan0

Note that you have to change user and host for your owns...
post #242 of 305
Quote:
Originally Posted by TrueZ0D View Post

First of all, sry for my English level...

This is a simple script to launch on startup or whenever you want, to change your MAC automatically for another randomly known one...

I recomend to put on startup scripts... so everytime you restart your machine, your MAC will be changed...

If set on startup, It's really usefull for pentesters...

If you have a wifi with mac filter, then this can cause some connection troubles... XD

Note that interface wlan0 may change depending on the system... Use your own...
Note that needs macchanger installed on system...
Code:
sudo ifconfig wlan0 down
sudo macchanger -A wlan0
sudo ifconfig wlan0 up

Note that needs to create some rules on suddoers file to not ask for password...
To add thir rule, launch:

$ sudo visudo

and add:
Code:
user host = (root) NOPASSWD:  /sbin/ifconfig/wlan0 down
user host = (root) NOPASSWD:  /sbin/ifconfig/wlan0 up
user host = (root) NOPASSWD:  /usr/bin/macchanger -A wlan0

Note that you have to change user and host for your owns...

Not necessarily, I use airodump to watch a network, and look for any clients connected to it, I grab their mac addresses, and put them in a file, I then run a script to randomly choose a line in file of mac addresses and change mac to that one.

Most of this I do in openwrt device,

I will later be working on script to detect of mac filtering is enabled or not.

edit; you can always make your own random (or brand name) mac address generator. Would be simple to do.. I'm gonna go work on one now. smile.gif
Edited by andyroo89 - 9/13/15 at 7:07am
Collecting Dust
(13 items)
 
Server
(9 items)
 
 
CPUMotherboardGraphicsRAM
E8400 3.0ghz OC @ 3.8GHz @ 1.36v DFI BLood Iron P35 none OCZ 2x 2gb DDR2 800 CAS @ 5-6-6-21 
Hard DriveOptical DriveOSMonitor
none none loonix ssh is my monitor 
KeyboardPowerCaseMouse
none Corsair 650 watts old pc case Logitech mx518 
Mouse Pad
none! 
CPUMotherboardGraphicsRAM
AMD Athlon 64 X2 Dual Core Processor 6000+ GX611AA-ABA m8300f onboard 1x 2GB OCZ RAM DDR 
Hard DriveOSMonitorPower
320gb + 1TB HDD xubuntu 14.04 SSH 350 watt 
Case
crappy HP case 
  hide details  
Reply
Collecting Dust
(13 items)
 
Server
(9 items)
 
 
CPUMotherboardGraphicsRAM
E8400 3.0ghz OC @ 3.8GHz @ 1.36v DFI BLood Iron P35 none OCZ 2x 2gb DDR2 800 CAS @ 5-6-6-21 
Hard DriveOptical DriveOSMonitor
none none loonix ssh is my monitor 
KeyboardPowerCaseMouse
none Corsair 650 watts old pc case Logitech mx518 
Mouse Pad
none! 
CPUMotherboardGraphicsRAM
AMD Athlon 64 X2 Dual Core Processor 6000+ GX611AA-ABA m8300f onboard 1x 2GB OCZ RAM DDR 
Hard DriveOSMonitorPower
320gb + 1TB HDD xubuntu 14.04 SSH 350 watt 
Case
crappy HP case 
  hide details  
Reply
post #243 of 305
Quote:
Not necessarily, I use airodump to watch a network, and look for any clients connected to it, I grab their mac addresses, and put them in a file, I then run a script to randomly choose a line in file of mac addresses and change mac to that one.

Most of this I do in openwrt device,

I will later be working on script to detect of mac filtering is enabled or not.

edit; you can always make your own random (or brand name) mac address generator. Would be simple to do.. I'm gonna go work on one now. smile.gif

As I said, sry for my English level...

XD

I know the tricks of wifi exploitation... I was not talking about wifi pentest... I meant to do pentests in networks already have access, such as open networks, public, bars ... If you frequently connect to these networks and try sniffers, pentest tools against users... is easiest use a randomly generated MAC each time you log on.

Anyway, thanks for the trick... XD
post #244 of 305
Quote:
Originally Posted by TrueZ0D View Post

As I said, sry for my English level...

XD

I know the tricks of wifi exploitation... I was not talking about wifi pentest... I meant to do pentests in networks already have access, such as open networks, public, bars ... If you frequently connect to these networks and try sniffers, pentest tools against users... is easiest use a randomly generated MAC each time you log on.

Anyway, thanks for the trick... XD

Oh ok np
Collecting Dust
(13 items)
 
Server
(9 items)
 
 
CPUMotherboardGraphicsRAM
E8400 3.0ghz OC @ 3.8GHz @ 1.36v DFI BLood Iron P35 none OCZ 2x 2gb DDR2 800 CAS @ 5-6-6-21 
Hard DriveOptical DriveOSMonitor
none none loonix ssh is my monitor 
KeyboardPowerCaseMouse
none Corsair 650 watts old pc case Logitech mx518 
Mouse Pad
none! 
CPUMotherboardGraphicsRAM
AMD Athlon 64 X2 Dual Core Processor 6000+ GX611AA-ABA m8300f onboard 1x 2GB OCZ RAM DDR 
Hard DriveOSMonitorPower
320gb + 1TB HDD xubuntu 14.04 SSH 350 watt 
Case
crappy HP case 
  hide details  
Reply
Collecting Dust
(13 items)
 
Server
(9 items)
 
 
CPUMotherboardGraphicsRAM
E8400 3.0ghz OC @ 3.8GHz @ 1.36v DFI BLood Iron P35 none OCZ 2x 2gb DDR2 800 CAS @ 5-6-6-21 
Hard DriveOptical DriveOSMonitor
none none loonix ssh is my monitor 
KeyboardPowerCaseMouse
none Corsair 650 watts old pc case Logitech mx518 
Mouse Pad
none! 
CPUMotherboardGraphicsRAM
AMD Athlon 64 X2 Dual Core Processor 6000+ GX611AA-ABA m8300f onboard 1x 2GB OCZ RAM DDR 
Hard DriveOSMonitorPower
320gb + 1TB HDD xubuntu 14.04 SSH 350 watt 
Case
crappy HP case 
  hide details  
Reply
post #245 of 305
Debugged and running like a boss now. Versioned backups. Assembled this out of a google search on how to imitate Apples time machine.
Code:
data_backup() { # versioned backups $1 = name of backed up folder | $2 = /path/to/folder being backed up
        if ping -c 1 "$SERVER" ; then
                if [[ -e "$2" ]] ; then
                        if ssh "$USER"@"$SERVER" "[[ -e ${DATABACKUP}/${1}/current ]]" ; then
                                rsync -"$RSYNCOPT" --link-dest="$DATABACKUP"/"$1"/current "$2" "$USER"@"$SERVER":"$DATABACKUP"/"$1"/"$1"."$NOW"
                                ssh "$USER"@"$SERVER" "rm -f ${DATABACKUP}/${1}/current"
                        else
                                rsync -"$RSYNCOPT" "$2" "$USER"@"$SERVER":"$DATABACKUP"/"$1"/"$1"."$NOW"
                        fi
                        ssh "$USER"@"$SERVER" "ln -s ${DATABACKUP}/${1}/${1}.${NOW} ${DATABACKUP}/${1}/current"
                        ssh "$USER"@"$SERVER" "find ${DATABACKUP}/${1}/ -type d -mtime +${DATADAYS} -exec rm -fr {} \;"
                fi
        fi
}


*EDIT* Updated the above function to remove redundant line. Also learned something. Do not mount your nfs backups share from your server into your $HOME and run the backup on the $HOME directory... you backup the backup into the backup. Caused all kinds of problems. I solved that by mounting the server backups share in my data partition and creating a symlink in $HOME.
Edited by Tadaen Sylvermane - 9/16/15 at 9:20am
 
Micromachine
(8 items)
 
 
CPUMotherboardGraphicsRAM
i7 4500u Inspiron 15 7000 Integrated 8gb 
Hard DriveOSMouse
120gb Samsung EVO SSD Debian Logitech m705 
CPUMotherboardRAMHard Drive
AMD 5350 Kabini AsRock AM1H-ITX 8gb Gskill Ripjaws (2x4) Samsung 120 Evo 
Hard DriveHard DriveOSCase
WD 1tb 2.5 WD 2tb USB 3.0 Ubuntu Server 16.04 Antec ISK 
  hide details  
Reply
 
Micromachine
(8 items)
 
 
CPUMotherboardGraphicsRAM
i7 4500u Inspiron 15 7000 Integrated 8gb 
Hard DriveOSMouse
120gb Samsung EVO SSD Debian Logitech m705 
CPUMotherboardRAMHard Drive
AMD 5350 Kabini AsRock AM1H-ITX 8gb Gskill Ripjaws (2x4) Samsung 120 Evo 
Hard DriveHard DriveOSCase
WD 1tb 2.5 WD 2tb USB 3.0 Ubuntu Server 16.04 Antec ISK 
  hide details  
Reply
post #246 of 305
Quote:
Originally Posted by Tadaen Sylvermane View Post

you backup the backup into the backup

Yo dawg.
post #247 of 305
Added this to my .xinitrc yesterday:
Code:
random_wallpaper_loop() {
    while true; do
        feh --bg-max $(ls -d $HOME/Pictures/Wallpaper/1080/* | shuf -n1)
        sleep 60
    done
}

Changes the wallpaper randomly every minute
post #248 of 305
Quote:
Originally Posted by Ferrari8608 View Post

Added this to my .xinitrc yesterday:
Code:
random_wallpaper_loop() {
    while true; do
        feh --bg-max $(ls -d $HOME/Pictures/Wallpaper/1080/* | shuf -n1)
        sleep 60
    done
}

Changes the wallpaper randomly every minute

Oh nice, I like it.

I am working on multiple scripts.

I am currently working on pastebin scraper in python, and beautifulsoup4.
Collecting Dust
(13 items)
 
Server
(9 items)
 
 
CPUMotherboardGraphicsRAM
E8400 3.0ghz OC @ 3.8GHz @ 1.36v DFI BLood Iron P35 none OCZ 2x 2gb DDR2 800 CAS @ 5-6-6-21 
Hard DriveOptical DriveOSMonitor
none none loonix ssh is my monitor 
KeyboardPowerCaseMouse
none Corsair 650 watts old pc case Logitech mx518 
Mouse Pad
none! 
CPUMotherboardGraphicsRAM
AMD Athlon 64 X2 Dual Core Processor 6000+ GX611AA-ABA m8300f onboard 1x 2GB OCZ RAM DDR 
Hard DriveOSMonitorPower
320gb + 1TB HDD xubuntu 14.04 SSH 350 watt 
Case
crappy HP case 
  hide details  
Reply
Collecting Dust
(13 items)
 
Server
(9 items)
 
 
CPUMotherboardGraphicsRAM
E8400 3.0ghz OC @ 3.8GHz @ 1.36v DFI BLood Iron P35 none OCZ 2x 2gb DDR2 800 CAS @ 5-6-6-21 
Hard DriveOptical DriveOSMonitor
none none loonix ssh is my monitor 
KeyboardPowerCaseMouse
none Corsair 650 watts old pc case Logitech mx518 
Mouse Pad
none! 
CPUMotherboardGraphicsRAM
AMD Athlon 64 X2 Dual Core Processor 6000+ GX611AA-ABA m8300f onboard 1x 2GB OCZ RAM DDR 
Hard DriveOSMonitorPower
320gb + 1TB HDD xubuntu 14.04 SSH 350 watt 
Case
crappy HP case 
  hide details  
Reply
post #249 of 305
Code:
#!/bin/bash
#
# This is a script  to backup /raid/backup to /external using rsync

# VARIABLES
SOURCE=/raid/backup
DEST=/ext
LOG=/root/rsynclog
DISK=/dev/mapper/ext
LOOPCTRL="-1"

# FUNCTIONS
mountdisk() {
        echo "Destination disk not mounted!"
        echo "Mounting $DISK to $DEST"
        if [[ -e $DISK ]];
        then
          mount $DISK $DEST
        else
          echo "$DISK does not exist! Exiting..."
          exit 1
        fi
        }

rsyncexec() {
        rsync --log-file=$LOG --delete-after -avh $SOURCE $DEST
        }

# SCRIPT
while [[ $LOOPCTRL != "0" ]];
do
 if [[ -e /ext/backup ]];
        then
          rsyncexec
          LOOPCTRL="0"
        else
          mountdisk
 fi
done


Fairly inexperienced at bash scripting. Just popped this one out. I cron this nightly at 1AM to rsync the files I consider important from my file server to an external HDD that is LUKS encrypted (hence /dev/mapper/ext). I rotate this HDD out on a weekly basis with a drive I keep in an offsite location for data safety.

If the script can be optimized, suggest me some fixes.
Edited by PsycoCarrot - 10/17/15 at 10:36am
post #250 of 305
Ok guys I started working on my rss script in python, and was wondering if I want to add new show to my rss script (to search for and auto download) how would I do that? using dictionary?
Collecting Dust
(13 items)
 
Server
(9 items)
 
 
CPUMotherboardGraphicsRAM
E8400 3.0ghz OC @ 3.8GHz @ 1.36v DFI BLood Iron P35 none OCZ 2x 2gb DDR2 800 CAS @ 5-6-6-21 
Hard DriveOptical DriveOSMonitor
none none loonix ssh is my monitor 
KeyboardPowerCaseMouse
none Corsair 650 watts old pc case Logitech mx518 
Mouse Pad
none! 
CPUMotherboardGraphicsRAM
AMD Athlon 64 X2 Dual Core Processor 6000+ GX611AA-ABA m8300f onboard 1x 2GB OCZ RAM DDR 
Hard DriveOSMonitorPower
320gb + 1TB HDD xubuntu 14.04 SSH 350 watt 
Case
crappy HP case 
  hide details  
Reply
Collecting Dust
(13 items)
 
Server
(9 items)
 
 
CPUMotherboardGraphicsRAM
E8400 3.0ghz OC @ 3.8GHz @ 1.36v DFI BLood Iron P35 none OCZ 2x 2gb DDR2 800 CAS @ 5-6-6-21 
Hard DriveOptical DriveOSMonitor
none none loonix ssh is my monitor 
KeyboardPowerCaseMouse
none Corsair 650 watts old pc case Logitech mx518 
Mouse Pad
none! 
CPUMotherboardGraphicsRAM
AMD Athlon 64 X2 Dual Core Processor 6000+ GX611AA-ABA m8300f onboard 1x 2GB OCZ RAM DDR 
Hard DriveOSMonitorPower
320gb + 1TB HDD xubuntu 14.04 SSH 350 watt 
Case
crappy HP case 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Linux, Unix
Overclock.net › Forums › Software, Programming and Coding › Operating Systems › Linux, Unix › Share your Scripts