Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.AWTException;
- import java.awt.Color;
- import java.awt.MouseInfo;
- import java.awt.Robot;
- import java.awt.event.InputEvent;
- import java.awt.event.KeyEvent;
- import java.util.Properties;
- import java.util.concurrent.TimeUnit;
- import javax.mail.Message;
- import javax.mail.MessagingException;
- import javax.mail.PasswordAuthentication;
- import javax.mail.Session;
- import javax.mail.Transport;
- import javax.mail.internet.AddressException;
- import javax.mail.internet.InternetAddress;
- import javax.mail.internet.MimeMessage;
- import javax.sound.sampled.AudioInputStream;
- import javax.sound.sampled.AudioSystem;
- import javax.sound.sampled.Clip;
- public class Bot {
- public static final int TICKET_X = 930; //1163
- public static final int TICKET_Y = 600; //750
- public static final int BUTTON1_X = 1200;
- public static final int BUTTON1_Y = 600;
- public static final int BUTTON2_X = 1200;
- public static final int BUTTON2_Y = 520;
- public int listing_color_white = new Color(255,255,255).getRGB();
- public int button_color_green = new Color(26, 210, 108).getRGB();
- public int button_color_green_hover = new Color(51, 216, 125).getRGB();
- public void Move() throws InterruptedException, AWTException {
- Robot bot = new Robot();
- TimeUnit.MILLISECONDS.sleep(3000);
- // check for tickets
- bot.mouseMove(0, 0);
- bot.mouseMove(TICKET_X, TICKET_Y); // move to ticket
- while (bot.getPixelColor(MouseInfo.getPointerInfo().getLocation().x, MouseInfo.getPointerInfo().getLocation().y)
- .getRGB() == listing_color_white ) {
- bot.keyPress(KeyEvent.VK_F5);
- bot.keyRelease(KeyEvent.VK_F5);
- TimeUnit.MILLISECONDS.sleep(2000);
- if (bot.getPixelColor(MouseInfo.getPointerInfo().getLocation().x,
- MouseInfo.getPointerInfo().getLocation().y).getRGB() != listing_color_white) {
- break;
- }
- }
- bot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
- bot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
- PlaySound();
- bot.mouseMove(BUTTON1_X, BUTTON1_Y); // move to buy button 1
- while (bot.getPixelColor(MouseInfo.getPointerInfo().getLocation().x, MouseInfo.getPointerInfo().getLocation().y).getRGB() != button_color_green) {
- TimeUnit.MILLISECONDS.sleep(100);
- }
- bot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
- bot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
- bot.mouseMove(BUTTON2_X, BUTTON2_Y); // move to buy button 2
- SendEmail();
- while (bot.getPixelColor(MouseInfo.getPointerInfo().getLocation().x, MouseInfo.getPointerInfo().getLocation().y)
- .getRGB() != button_color_green_hover) {
- TimeUnit.MILLISECONDS.sleep(500);
- }
- bot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
- bot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
- TimeUnit.MILLISECONDS.sleep(240000);
- }
- public void PlaySound() {
- try {
- AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(this.getClass().getResource("toppertje.wav"));
- Clip clip = AudioSystem.getClip();
- clip.open(audioInputStream);
- clip.start();
- // If you want the sound to loop infinitely, then put: clip.loop(Clip.LOOP_CONTINUOUSLY);
- // If you want to stop the sound, then use clip.stop();
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }
- public void SendEmail() {
- final String username = "luukpook@gmail.com";
- final String password = "xxxxxx";
- Properties props = new Properties();
- props.put("mail.smtp.auth", "true");
- props.put("mail.smtp.starttls.enable", "true");
- props.put("mail.smtp.host", "smtp.gmail.com");
- props.put("mail.smtp.port", "587");
- Session session = Session.getInstance(props,
- new javax.mail.Authenticator() {
- protected PasswordAuthentication getPasswordAuthentication() {
- return new PasswordAuthentication(username, password);
- }
- });
- try {
- Message message = new MimeMessage(session);
- message.setFrom(new InternetAddress("luukpook@gmail.com"));
- message.setRecipients(Message.RecipientType.TO,
- InternetAddress.parse("luukpook@gmail.com"));
- message.setSubject("Ticket in winkelwagen");
- message.setText("https://www.ticketswap.nl/cart");
- Transport.send(message);
- System.out.println("Email sent");
- } catch (MessagingException e) {
- throw new RuntimeException(e);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement