MCPcopy Create free account
hub / github.com/NARKOZ/hacker-scripts / FuckingCoffee

Class FuckingCoffee

java/FuckingCoffee.java:4–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2import java.io.*;
3
4public class FuckingCoffee{
5
6 private static final String MY_USERNAME = "my_username";
7 private static final String PASSWORD_PROMPT = "Password: ";
8 private static final String PASSWORD = "1234";
9 private static final String COFFEE_MACHINE_IP = "10.10.42.42";
10 private static int DELAY_BEFORE_BREW = 17;
11 private static int DELAY = 24;
12
13 public static void main(String[] args)throws Exception{
14 for(int i = 1; i< args.length ; i++){
15 if(!args[i].contains(MY_USERNAME)){
16 return;
17 }
18 }
19 Socket telnet = new Socket(COFFEE_MACHINE_IP, 23);
20 PrintWriter out = new PrintWriter(telnet.getOutputStream(), true);
21 BufferedReader in = new BufferedReader(new InputStreamReader(telnet.getInputStream()));
22 Thread.sleep(DELAY_BEFORE_BREW*1000);
23 if(!in.readLine().equals(PASSWORD_PROMPT)){
24 return ;
25 }
26 out.println(PASSWORD);
27 out.println("sys brew");
28 Thread.sleep(DELAY*1000);
29 out.println("sys pour");
30 out.close();
31 in.close();
32 telnet.close();
33 }
34}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected