Let's make a bash script together anonymous.
I'm going to start off, if you can think of better ways to do this please post! Hints and tips are good too.
OK, so what should our script do? Let's start with generating a random IP address. Once we've got that down, we'll decide what to do with it. (cont)
>>58329221
OK, so what I'll be using to get some random numbers is a commnand that is probably in all your bash shells called shuf. Let's tell shuff to spit out some random numbers between 1 and 255. 4 of them to be exact.$ shuf -i 1-255 -n 4
42
140
206
41
Well it's a start, but the numbers aren't very usable like that.
>>58329272
So what we want to do is get all the numbers on a line, with dots inbetween them.
I'll use tr.
The reason the numbers are on different lines is there is an invisible character that tells the terminal to go to a new line. It's symbolised by this "\n".
So we use tr to find these characters and replace them. We'll be doing this by putting a pipe symbol at the end of the last command to pipe the output into tr, then handling it.$ shuf -i 1-255 -n 4|tr '\n' "."
180.181.147.18.
Now that's a lot more usable, but it unfortunately has the trailing dot after the last number, making it unusable in other scripts. And the four different fields fo the IP can be 1 or 3 characters, so you can't just slap a character specific limit on it. What would you do?
>>58329347
What I'm going to do is instead of straight away replacing the newlines with dots, replace them with spaces. Then feed them into awk, so I can treat each space seperated field as a variable to echo, and stick the dots inbetween them then.$ shuf -i 1-255 -n 4|tr '\n' " "|awk {'print $1 "." $2 "." $3 "." $4 '}
174.73.231.143
Hey, it works! So now we have a randomly generated IP address.
What do you think should be done with it /g/?
Can you tear yourself away from your lame consumerist advertising threads? Would you rather talk about headphones?
You make a thread and ask people to write a script together and then you samefag the fucking thing yourself
>>58329781
I was hoping people suggest better ways to do things. Anyway I stopped now until I get some more input because I think this is pointless. I'm betting zero people here know how to bash script further than ls and rm -rf / --no-preserve-root
I'm interested... Just don't know bash...
I'm making an email marketing bash script.
- Scrapes a target website for emails.
- Scrapes relevant info that I can use to personalize the email, their FB presence, Twitter followers, how often they post, if they have a blog, etc.
- Sends mail to all emails scraped introducing myself and asking if they are the right person to talk to.
>>58330591
You're a faggot dude. I hate spammers.
How you doing it, wget + grep?