Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Bash STDOUT

Name: Anonymous 2012-09-21 8:29

I'm writing a script, and it's just about finished. Thing is, it calls a lot of sub-processes that spit terminal output to the screen. Now, I've figured out that you stop this with


exec 1>/dev/null 2>/dev/null


but I want to periodically re-enable STDOUT so I can echo updates about what the program is doing.

Any of you /prog/ geezers know what I should do?

Any and all answers appreciated. [spoiler]Yes, even you who is going to post REDIRECT MY ANUS.

Name: Anonymous 2012-09-21 8:29

[/spoiler]

Bollocks.

Name: Anonymous 2012-09-21 9:02

Ah, nevermind. Turns out that

exec 1>/dev/tty


Does the job.

Name: Sesame Street Lecture 2012-09-21 11:17

Please use [m] tags when pasting shell code. Syntax highlighting is too weird.

Yes:

exec 1>/dev/tty

No:

[code]exec 1>/dev/tty[/m]

Name: Anonymous 2012-09-21 11:29

>>4
AH AH FAGGOT

Name: sage 2012-09-21 11:33

lots of bbcoed failuer in this thraed

Name: Anonymous 2012-09-21 11:44

>>6
Haha, that was pretty funny

Name: !L33tUKZj5I 2012-09-21 12:23

>>4
Please use [m] tags when pasting shell code. Syntax highlighting is too weird.
For you, I will.

Here's the code in case anyone cares. It's not finished yet (obviously) as it's only testing on port 8080. Next time I have a session on it, I'm going to add commandline flags for which ports/how many IP's to scan.

####################################################
# Proxyharvest V 0.9.                              #
#                                                  #
# Usage: ./proxyharvest                            #
#                                                  #
# Disclaimer: Don't use this program to be a dick. #
#                                                  #
# Written by withnail                              #
#                                                  #
####################################################

clear
echo "Starting the random proxy scan. This may take some time, please be patient."
exec 1>/dev/null 2>/dev/null
nmap -iR 10000 -p 8080 -oG /usr/share/proxyharvest/proxy_scan.txt
exec 1>/dev/tty
echo "Proxy scanning complete. Now checking whether found proxies are open."
echo " ";echo "Let's first fetch a file to use for proxy validity checking."
exec 1>/dev/null 2>/dev/null
wget microsoft.com/favicon.ico -O /usr/share/proxyharvest/checker.ico
exec 1>/dev/tty
if [ -f /usr/share/proxyharvest/checker.ico ] ; then echo " ";echo "Known good file fetched."; else echo "Unable to download the validity checker file! Please check your network connection."; fi
echo " ";echo "Ok, now checking found open ports. Bad proxies will be saved in another log in case you want to look at them.";echo " "
exec 1>/dev/null 2>/dev/null
    grep 8080/open /usr/share/proxyharvest/proxy_scan.txt|while read line;do
    echo $line|awk {'system ("wget -e http_proxy="$2":8080 microsoft.com/favicon.ico -O /usr/share/proxyharvest/temp.ico")'}
    diff /usr/share/proxyharvest/temp.ico /usr/share/proxyharvest/checker.ico
    if  [ $? -eq 0 ]
    then echo $line>>/usr/share/proxyharvest/known_good.txt;exec 1>/dev/tty;echo "Found one! Check logfiles";exec 1>/dev/null 2>/dev/null

    else exec 1>/dev/tty;echo "Proxy was false.";exec 1>/dev/null 2>/dev/null;echo $line>>/usr/share/proxyharvest/other_devices.txt
    rm /usr/share/proxyharvest/temp.ico
fi

done
exec 1>/dev/tty
echo "Program finished. Here are the known good proxies (if any):"
cat /usr/share/proxyharvest/known_good.txt



I've left that in a cron job now I know it works. Maybe sometime before Christmas it will find me a a proxy instead of a device config page that's been left open to the net.

Disclaimer: If you want to run this yourself, you need to create /usr/bin/proxyharvest yourself, otherwise it won't work. I'm going to write a makefile for it which checks all relevant needed programs are installed and creates the directory it needs.

In before massive flaming and telling me how shit I am.

Name: Anonymous 2012-09-21 12:37

>>8
Your hax0r name is withnail? Nobody is going to flame you or tell you how shit you are

Name: !L33tUKZj5I 2012-09-21 12:40

>>9
I've used withnail for over ten years, picked it when I used to hang around efnet. Haven't been there in years, but I still use that name for this kinda shit.
Link related.
http://qdb.us/search?q=withnail
I was never cool enough to get a quote submitted on bash.org ;_;

Nobody is going to flame you or tell you how shit you are

I suspect you're wrong.

Name: Anonymous 2012-09-21 12:57

Don't use this program to be a dick

FUCK YOU. YOU SUCK. YOUR PROGRAM SUCKS.

Name: !L33tUKZj5I 2012-09-21 12:59

>>11
;_;

Name: Anonymous 2012-09-21 13:40

>>12

just re-release it without that pathetic warning problem solved

Name: !L33tUKZj5I 2012-09-21 14:01

>>13
I wasn't really crying, nigga. The disclaimer is kinda a joke, as you can't really use the program to do anything bad on its own.

What really does need changing is that shit where if the checker file doesn't download. It needs exit 1; added in there.

Also, it's laughable to run the portscan, then have something that handles whether the network is up or not...that should really be first.

Name: Anonymous 2012-09-21 17:13

>>10
I was never cool enough to get a quote submitted on bash.org ;_;
I was

Name: Anonymous 2012-09-21 17:40

exec &>/dev/null
OMG OPTIMIZED

Name: !L33tUKZj5I 2012-09-21 17:44

>>15
Link please!
Yes, I'm jealous.

Name: Anonymous 2012-09-21 18:36

Vanity trips on my /pogs/? Terrible! Back to lounge with you!

Name: !L33tUKZj5I 2012-09-22 5:03

>>16
Yeah, I found that out later. Should change that.

Name: !L33tUKZj5I 2012-09-22 18:06

Bump for  >>15 to tell me what bash.org quote he got approved.

Name: Anonymous 2012-09-22 18:20

>>20
YHBT

Name: Anonymous 2012-09-22 18:35

>>20
Why don't you drop your trip, nigger? Only Cudder and Xarn are allowed to do that.

Name: Anonymous 2012-09-22 18:39

>>22
You're an idiot.

Name: Anonymous 2012-09-22 18:44

>>23
At least not dumber than >>20-san.

Name: Anonymous 2013-09-01 20:32



           rァ‐ァ‐、   rr‐-、
           {| {|::::::\ {|:::::::::',、   ,..::´ ̄「l
            ', ',::::::::::::':,}|::::::::::|{   /:::::::::::/r'
            \\::::::::_|}___」{、_/::::::::::::::/r'
            __,>'"´:.:.:.:.:.:.:.:.:.:.:.: ̄`゙''<」、
        rァ'"´:::/:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:`ヽ;:::\
       //::::::__/:.:.:.:.:;':.:.__!_:.:.:.:/!:.:.:.;'!:_:./|:.:.:.:\::::`::ー-rァ  r/\__
         ̄ ̄/:.:.:;.:/:.´/ |__//:.:.://:.:/`.!.:.:.:.:.|:.\:::::::/r'  /|::::::::/
        r/\:/7:.:.:;'ァ'iこハ \./-ァテ=r,、|:.:.:.:.:.!:.:.:.:', ̄     |/:::/
      ,r/::::(\  |_:.:八 j__,r!    |  り ノ:.:.:.:.:.|:.:.:.:.:!\    //
      .|7:::::::!と、`' <7""        ´ ̄ ゙゙ /:.:.:.:.:;':.:.:./、:::::`>'´
      {|::::::::|{  \/:.,:ヘ、    i ̄`ヽ  /:.:;'.:.:./:.:/   ̄
      }|__/ _ |/:.:.:.:|`>,.、.,,__ノ /:.:.:.:/:/イ   /)
      ,. -─    |:.:.:.:/}/  |_> '":.:.:.:./-‐rァ‐rァ‐'i´つノ-=ニ二>
  /        __. ',:./ゝ-‐''"´:.:.:.:.:.:.;: イ   /r'::::::}|_,./|'"´
  |         }|:::::::\ト、_;;::-‐rァ<´  ! / r'::::::/ |/    `ヽ
   `    、_ {!-─-、|こ〈:.:.:.:.:.|{::::::::\__./ /‐''"  /:| _ _ ノ 
      `'ー  ,>-‐ア⌒ト<二リへr<\ ∨    /::/    -─ '
         |」_::::::::|:.:.:ノ:::::::::::/:::::::!;:--、:::':,    く/         ノ
         >、ヽ._レ'´:::::::::::::::::::::::ノ:::r‐、:::::|〉   _  --─ ''"´
        /モ、>ヽ二二ニ=-、__:::`::-':/|
        └‐'          .!ー-ハ二ン-'
                   |王/
                   └‐'

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List