Fetch invalid bot methods from pwrtelegram

This commit is contained in:
Lonami Exo 2018-06-06 17:03:49 +02:00
parent ed5c44a260
commit c7d7977951
5 changed files with 33 additions and 33 deletions

View File

@ -64,3 +64,4 @@ USER_ALREADY_PARTICIPANT=The authenticated user is already a participant of the
USER_DEACTIVATED=The user has been deleted/deactivated
FLOOD_WAIT_X=A wait of {} seconds is required
FLOOD_TEST_PHONE_WAIT_X=A wait of {} seconds is required in the test servers
CHAT_NOT_MODIFIED=The chat or channel wasn't modified (title, invites, username, admins, etc. are the same).ç

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
["account.changePhone", "account.checkUsername", "account.confirmPhone", "account.deleteAccount", "account.getAccountTTL", "account.getAuthorizations", "account.getNotifySettings", "account.getPassword", "account.getPasswordSettings", "account.getPrivacy", "account.getTmpPassword", "account.getWallPapers", "account.registerDevice", "account.reportPeer", "account.resetAuthorization", "account.resetNotifySettings", "account.sendChangePhoneCode", "account.sendConfirmPhoneCode", "account.setAccountTTL", "account.setPrivacy", "account.unregisterDevice", "account.updateDeviceLocked", "account.updateNotifySettings", "account.updatePasswordSettings", "account.updateProfile", "account.updateStatus", "account.updateUsername", "auth.cancelCode", "auth.checkPassword", "auth.checkPhone", "auth.recoverPassword", "auth.requestPasswordRecovery", "auth.resendCode", "auth.resetAuthorizations", "auth.sendCode", "auth.sendInvites", "auth.signIn", "auth.signUp", "channels.checkUsername", "channels.createChannel", "channels.deleteChannel", "channels.deleteUserHistory", "channels.exportMessageLink", "channels.getAdminedPublicChannels", "channels.getAdminLog", "channels.inviteToChannel", "channels.joinChannel", "channels.readHistory", "channels.readMessageContents", "channels.reportSpam", "channels.toggleInvites", "channels.toggleSignatures", "channels.updateUsername", "contacts.block", "contacts.deleteContact", "contacts.deleteContacts", "contacts.exportCard", "contacts.getBlocked", "contacts.getContacts", "contacts.getStatuses", "contacts.getTopPeers", "contacts.importCard", "contacts.importContacts", "contacts.resetTopPeerRating", "contacts.search", "contacts.unblock", "help.getAppChangelog", "help.getAppUpdate", "help.getInviteText", "help.getNearestDc", "help.getSupport", "help.getTermsOfService", "help.saveAppLog", "langpack.getDifference", "langpack.getLangPack", "langpack.getLanguages", "langpack.getStrings", "messages.acceptEncryption", "messages.addChatUser", "messages.checkChatInvite", "messages.clearRecentStickers", "messages.createChat", "messages.deleteHistory", "messages.discardEncryption", "messages.editChatAdmin", "messages.exportChatInvite", "messages.getAllChats", "messages.getAllDrafts", "messages.getAllStickers", "messages.getArchivedStickers", "messages.getAttachedStickers", "messages.getBotCallbackAnswer", "messages.getCommonChats", "messages.getDhConfig", "messages.getDialogs", "messages.getFeaturedStickers", "messages.getHistory", "messages.getInlineBotResults", "messages.getMaskStickers", "messages.getMessageEditData", "messages.getMessagesViews", "messages.getPeerDialogs", "messages.getPeerSettings", "messages.getPinnedDialogs", "messages.getRecentStickers", "messages.getSavedGifs", "messages.getUnreadMentions", "messages.getWebPage", "messages.getWebPagePreview", "messages.hideReportSpam", "messages.importChatInvite", "messages.installStickerSet", "messages.migrateChat", "messages.readFeaturedStickers", "messages.readHistory", "messages.readMessageContents", "messages.receivedMessages", "messages.reorderPinnedDialogs", "messages.reorderStickerSets", "messages.reportEncryptedSpam", "messages.reportSpam", "messages.requestEncryption", "messages.saveDraft", "messages.saveGif", "messages.saveRecentSticker", "messages.search", "messages.searchGifs", "messages.searchGlobal", "messages.sendInlineBotResult", "messages.sendScreenshotNotification", "messages.setEncryptedTyping", "messages.startBot", "messages.toggleChatAdmins", "messages.toggleDialogPin", "messages.uninstallStickerSet", "payments.clearSavedInfo", "payments.getPaymentForm", "payments.getPaymentReceipt", "payments.getSavedInfo", "payments.sendPaymentForm", "payments.validateRequestedInfo", "phone.acceptCall", "phone.confirmCall", "phone.discardCall", "phone.getCallConfig", "phone.receivedCall", "phone.requestCall", "phone.saveCallDebug", "phone.setCallRating", "photos.deletePhotos", "photos.updateProfilePhoto", "photos.uploadProfilePhoto", "upload.getCdnFile", "upload.getWebFile"]

View File

@ -1,32 +0,0 @@
import sys
import json
import urllib.request
OUT = 'data/errors.json'
URL = 'https://rpc.pwrtelegram.xyz/?all'
def fetch_errors(output, url=URL):
print('Opening a connection to', url, '...')
r = urllib.request.urlopen(urllib.request.Request(
url, headers={'User-Agent' : 'Mozilla/5.0'}
))
print('Checking response...')
data = json.loads(
r.read().decode(r.info().get_param('charset') or 'utf-8')
)
if data.get('ok'):
print('Response was okay, saving data')
with open(output, 'w', encoding='utf-8') as f:
json.dump(data, f, sort_keys=True)
return True
else:
print('The data received was not okay:')
print(json.dumps(data, indent=4, sort_keys=True))
return False
if __name__ == '__main__':
out = OUT if len(sys.argv) < 2 else sys.argv[2]
url = URL if len(sys.argv) < 3 else sys.argv[3]
fetch_errors(out, url)

View File

@ -0,0 +1,30 @@
import sys
import json
import urllib.request
FILES = (
('data/errors.json', 'https://rpc.pwrtelegram.xyz/?all'),
('data/invalid_bot_methods.json', 'https://rpc.pwrtelegram.xyz/?bot')
)
def fetch_json(output, url):
r = urllib.request.urlopen(urllib.request.Request(
url, headers={'User-Agent' : 'Mozilla/5.0'}
))
data = json.loads(
r.read().decode(r.info().get_param('charset') or 'utf-8')
)
if data.get('ok'):
del data['ok']
if len(data) == 1:
data = data[next(iter(data.keys()))]
with open(output, 'w', encoding='utf-8') as f:
json.dump(data, f, sort_keys=True)
else:
print(json.dumps(data, indent=4, sort_keys=True), file=sys.stderr)
if __name__ == '__main__':
for output, url in FILES:
fetch_json(output, url)