mirror of
https://github.com/narkoz/hacker-scripts
synced 2025-08-28 05:07:46 +00:00
Changed naming conventions to be in line with java. Added dependency
pre-requisite comments Merge pull request #1 from NARKOZ/master
This commit is contained in:
commit
08c60994f8
34
java/FuckingCoffee.java
Normal file
34
java/FuckingCoffee.java
Normal file
@ -0,0 +1,34 @@
|
||||
import java.net.*;
|
||||
import java.io.*;
|
||||
|
||||
public class FuckingCoffee{
|
||||
|
||||
private static final String MY_USERNAME = "my_username";
|
||||
private static final String PASSWORD_PROMPT = "Password: ";
|
||||
private static final String PASSWORD = "1234";
|
||||
private static final String COFFEE_MACHINE_IP = "10.10.42.42";
|
||||
private static int DELAY_BEFORE_BREW = 17;
|
||||
private static int DELAY = 24;
|
||||
|
||||
public static void main(String[] args)throws Exception{
|
||||
for(int i = 1; i< args.length ; i++){
|
||||
if(!args[i].contains(MY_USERNAME)){
|
||||
return;
|
||||
}
|
||||
}
|
||||
Socket telnet = new Socket(COFFEE_MACHINE_IP, 23);
|
||||
PrintWriter out = new PrintWriter(telnet.getOutputStream(), true);
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(telnet.getInputStream()));
|
||||
Thread.sleep(DELAY_BEFORE_BREW*1000);
|
||||
if(!in.readLine().equals(PASSWORD_PROMPT)){
|
||||
return ;
|
||||
}
|
||||
out.println(PASSWORD);
|
||||
out.println("sys brew");
|
||||
Thread.sleep(DELAY*1000);
|
||||
out.println("sys pour");
|
||||
out.close();
|
||||
in.close();
|
||||
telnet.close();
|
||||
}
|
||||
}
|
44
java/Hangover.java
Normal file
44
java/Hangover.java
Normal file
@ -0,0 +1,44 @@
|
||||
import com.twilio.sdk.TwilioRestClient;
|
||||
import com.twilio.sdk.TwilioRestException;
|
||||
import com.twilio.sdk.resource.factory.MessageFactory;
|
||||
import com.twilio.sdk.resource.instance.Message;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class Hangover {
|
||||
|
||||
public static final String ACCOUNT_SID = System.getenv("TWILIO_ACCOUNT_SID");
|
||||
public static final String AUTH_TOKEN = System.getenv("TWILIO_AUTH_TOKEN");
|
||||
|
||||
public static final String YOUR_NUMBER = "1231231231";
|
||||
public static final String BOSS_NUMBER = "3213213213";
|
||||
|
||||
public static void main(String[] args) throws TwilioRestException {
|
||||
|
||||
TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);
|
||||
|
||||
String[] randomMessages = {
|
||||
"Locked out",
|
||||
"Pipes broke",
|
||||
"Food poisoning",
|
||||
"Not feeling well"
|
||||
};
|
||||
|
||||
int randomIndex = new Random().nextInt(randomMessages.length);
|
||||
String finalMessage = (randomMessages[randomIndex]);
|
||||
|
||||
List<NameValuePair> params = new ArrayList<NameValuePair>();
|
||||
params.add(new BasicNameValuePair("Body", "Gonna work from home. " + finalMessage));
|
||||
params.add(new BasicNameValuePair("From", YOUR_NUMBER));
|
||||
params.add(new BasicNameValuePair("To", BOSS_NUMBER));
|
||||
|
||||
MessageFactory messageFactory = client.getAccount().getMessageFactory();
|
||||
Message message = messageFactory.create(params);
|
||||
System.out.println(message.getSid());
|
||||
}
|
||||
}
|
||||
|
95
java/KumarAsshole.java
Normal file
95
java/KumarAsshole.java
Normal file
@ -0,0 +1,95 @@
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.util.*;
|
||||
import java.util.regex.*;
|
||||
|
||||
import javax.mail.*;
|
||||
import javax.mail.internet.*;
|
||||
import javax.mail.search.FlagTerm;
|
||||
//Dependencies- Java mail API
|
||||
|
||||
public class KumarAsshole {
|
||||
|
||||
public static void main(String[] args) {
|
||||
KumarAsshole asshole = new KumarAsshole();
|
||||
asshole.read();
|
||||
}
|
||||
|
||||
public void read() {
|
||||
Properties props = new Properties();
|
||||
|
||||
|
||||
//modify below properties to your details
|
||||
String host = "smtp.gmail.com";
|
||||
String username = "yourmailaddress@example.com goes here";
|
||||
String password = "your password goes here ";
|
||||
String Kumar_mail = "the mail address to be replied to !";
|
||||
|
||||
try {
|
||||
|
||||
Session session = Session.getDefaultInstance(props, null);
|
||||
|
||||
Store store = session.getStore("imaps");
|
||||
store.connect(host, username, password);
|
||||
|
||||
Folder inbox = store.getFolder("inbox");
|
||||
inbox.open(Folder.READ_ONLY);
|
||||
|
||||
Message messages[] = inbox.search(new FlagTerm(new Flags(Flags.Flag.SEEN), false));
|
||||
|
||||
for (int i = 0; i < messages.length; i++) {
|
||||
|
||||
if (messages[i].getFrom()[0].toString().contains(Kumar_mail)) {
|
||||
|
||||
String bodytext = null;
|
||||
Object content = messages[i].getContent();
|
||||
if (content instanceof String) {
|
||||
bodytext = (String) content;
|
||||
|
||||
} else if (content instanceof Multipart) {
|
||||
|
||||
Multipart mp = (Multipart) content;
|
||||
|
||||
BodyPart bp = mp.getBodyPart(mp.getCount() - 1);
|
||||
bodytext = (String) bp.getContent();
|
||||
|
||||
}
|
||||
|
||||
Pattern pattern = Pattern.compile("sorry|help|wrong", Pattern.CASE_INSENSITIVE);
|
||||
Matcher matcher = pattern.matcher(bodytext);
|
||||
// check all occurance
|
||||
|
||||
if (matcher.find()) {
|
||||
|
||||
Properties props1 = new Properties();
|
||||
Address[] tomail;
|
||||
|
||||
MimeMessage msg = new MimeMessage(session);
|
||||
msg.setFrom(new InternetAddress(username));
|
||||
tomail = messages[i].getFrom();
|
||||
String t1 = tomail[0].toString();
|
||||
msg.addRecipient(Message.RecipientType.TO, new InternetAddress(t1));
|
||||
msg.setSubject("Database fixes");
|
||||
msg.setText("No problem. I've fixed it. \n\n Please be careful next time.");
|
||||
Transport t = null;
|
||||
t = session.getTransport("smtps");
|
||||
t.connect(host, username, password);
|
||||
t.sendMessage(msg, msg.getAllRecipients());
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
inbox.close(true);
|
||||
store.close();
|
||||
|
||||
}catch(Exception e)
|
||||
{
|
||||
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
45
java/SmackMyBitch.java
Normal file
45
java/SmackMyBitch.java
Normal file
@ -0,0 +1,45 @@
|
||||
import com.twilio.sdk.TwilioRestClient;
|
||||
import com.twilio.sdk.TwilioRestException;
|
||||
import com.twilio.sdk.resource.factory.MessageFactory;
|
||||
import com.twilio.sdk.resource.instance.Message;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
//Pre-requisite apache http and twilio java libraries
|
||||
|
||||
|
||||
public class SmackMyBitch {
|
||||
|
||||
public static final String ACCOUNT_SID = System.getenv("TWILIO_ACCOUNT_SID");
|
||||
public static final String AUTH_TOKEN = System.getenv("TWILIO_AUTH_TOKEN");
|
||||
|
||||
public static final String YOUR_NUMBER = "1231231231";
|
||||
public static final String HER_NUMBER = "3213213213";
|
||||
|
||||
public static void main(String[] args) throws TwilioRestException {
|
||||
|
||||
TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);
|
||||
|
||||
String[] randomMessages = {
|
||||
"Working hard",
|
||||
"Gotta ship this feature",
|
||||
"Someone fucked the system again",
|
||||
};
|
||||
|
||||
int randomIndex = new Random().nextInt(randomMessages.length);
|
||||
String finalMessage = (randomMessages[randomIndex]);
|
||||
|
||||
List<NameValuePair> params = new ArrayList<NameValuePair>();
|
||||
params.add(new BasicNameValuePair("Body", "Late at work. " + finalMessage));
|
||||
params.add(new BasicNameValuePair("From", YOUR_NUMBER));
|
||||
params.add(new BasicNameValuePair("To", HER_NUMBER));
|
||||
|
||||
MessageFactory messageFactory = client.getAccount().getMessageFactory();
|
||||
Message message = messageFactory.create(params);
|
||||
System.out.println(message.getSid());
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user