File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change 1+ import java .net .*;
2+ import java .io .*;
3+
4+ public class fucking_coffee {
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 () != 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+ }
You can’t perform that action at this time.
0 commit comments