-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmain.py
executable file
·60 lines (50 loc) · 1.68 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 31 20:14:04 2019
@author: Kshitij Gupta <[email protected]>
"""
from bs4 import BeautifulSoup
from shutil import which
import requests
import time
import subprocess
import sys
def check_app(name):
ret = which(name) is not None
if not ret:
print('[*] command not found: {}'.format(name))
return ret
def main():
if not check_app('nyancat'):
print('Please install \'nyancat\'! Exiting.')
sys.exit()
term = input('Enter your terminal cmd (Eg. deepin-terminal, konsole): ')
if not check_app(term):
sys.exit()
url = 'https://android.googlesource.com/platform/manifest/+refs'
matching = []
while len(matching) == 0:
print('\n[*] Checking!')
tag_list = []
response = requests.get(url)
soup = BeautifulSoup(response.text, 'html.parser')
for li in soup.findAll('li', {'class': 'RefList-item'}):
tag = li.findChildren('a', recursive=False)[0]['href'].split('/')[-1]
tag_list.append(tag)
matching = [s for s in tag_list if 'android-12' in s or 'android12' in s]
if len(matching) > 0:
print('[!] ANDROID 12 IS HERE!')
print('[!] Result: {}'.format(matching))
else:
print('[*] No Android 12 (yet) 😕')
print('[*] Sleep time! 😴')
time.sleep(10 * 60) # Wait for 10 minutes
try:
from subprocess import DEVNULL
except ImportError:
import os
DEVNULL = open(os.devnull, 'wb')
subprocess.Popen([term, '-e', 'nyancat'], stdout=DEVNULL, stderr=subprocess.STDOUT)
if __name__ == '__main__':
main()