joaohunter

tft

Feb 11th, 2023
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 1.59 KB | Gaming | 0 0
  1. use warnings;
  2. use MIME::Base64;
  3. use LWP::UserAgent;
  4. use Data::Dumper;
  5. use JSON::Parse 'parse_json';
  6. use Time::HiRes qw(sleep);
  7.  
  8. my ($auth,$port) = @{ auth() };
  9. my @co = (state());
  10. while (1) {
  11.     my $state = state();
  12.   if ($co[-1] ne $state) {
  13.     push@co,$state;
  14.     print "State: $state\n"
  15.   }
  16.   if ($state eq 'Lobby') {
  17.     zamanf('POST','lol-lobby/v2/lobby/matchmaking/search',undef)  
  18.   } elsif ($state eq 'None') {
  19.     print "Searching for game...\n";
  20.     zamanf('POST','lol-lobby/v2/lobby','{"queueId": 1090}')
  21.   } elsif ($state eq 'Matchmaking') {
  22.     # wait
  23.   } elsif ($state eq 'ReadyCheck') {
  24.     zamanf('POST','lol-matchmaking/v1/ready-check/accept',undef);
  25.     print "Match Accepted\n";
  26.         #exit;   
  27.     }    
  28.   sleep 5
  29. }
  30. sub state {return zamanf('GET','lol-gameflow/v1/gameflow-phase',undef);}
  31. sub zamanf {
  32.   my $ua = LWP::UserAgent->new( ssl_opts => { verify_hostname => 0 }, protocols_allowed => ['https'] );
  33.   my $url = "https://127.0.0.1:$port/$_[1]";
  34.   my $req = HTTP::Request->new($_[0], $url);
  35.   $req->header( 'Accept' => 'application/json' );
  36.   $req->header( 'Content-Type' => 'application/json' );
  37.   $req->header( 'Authorization' => "Basic $auth" );
  38.   $req->content($_[2]);
  39.   my $data = $ua->request($req)->content;
  40.   if ($data) {
  41.     return parse_json($data)
  42.   }      
  43. }
  44. sub auth {
  45.   my $proc = `WMIC path win32_process get Caption,Commandline | find "--remoting-auth-token="`;
  46.   if ($proc =~ /--remoting-auth-token=(\S+)".*?--app-port=(\d+)/) {
  47.     return [ encode_base64(qq(\x72\x69\x6f\x74:$1)), $2 ]
  48.   }
  49. }
  50. #1090 tft 830 bot intro 840 bot beg 430 blind 450 aram
Tags: perl
Add Comment
Please, Sign In to add comment