def __init__(self): # добавить парсинг из конфига self.vk = vk() self.vk.init_vk() self.key = '' self.server = '' self.ts = 0 self.pts = 0 self.commands = [] self.commands_classes = []
def process(self, dataSource, progressBar): # we don't know how much work there is yet progressBar.switchToIndeterminate() # This will work in 4.0.1 and beyond # Use blackboard class to index blackboard artifacts for keyword search # blackboard = Case.getCurrentCase().getServices().getBlackboard() # Find files named, regardless of parent path fileManager = Case.getCurrentCase().getServices().getFileManager() vk_files = fileManager.findFiles(dataSource, "vk.db") kate_files = fileManager.findFiles(dataSource, "kate.db") viber_calls_files = fileManager.findFiles(dataSource, "viber_data") viber_messages_files = fileManager.findFiles(dataSource, "viber_messages") skype_files = fileManager.findFiles(dataSource, "%.db", "com.skype.raider") gmail_files = fileManager.findFiles(dataSource, "mailstore.%.db", "com.google.android.%") aquamail_files = fileManager.findFiles(dataSource, "Messages.%", "org.kman.AquaMail") odnoklassniki_files = fileManager.findFiles(dataSource, "odnklassniki.db") odnoklassniki_files_tam = fileManager.findFiles( dataSource, "tamtam_messages") rugram_files = fileManager.findFiles(dataSource, "cache4.db", "com.rugram.%") if self.local_settings.getSetting('Flag') == 'true': all_db_files = fileManager.findFiles(dataSource, "%.db") sqlite_files = fileManager.findFiles(dataSource, "%.sqlite") else: all_db_files, sqlite_files = [], [] numFiles = len(vk_files) + len(kate_files) + len(viber_calls_files) + \ len(viber_messages_files) + len(skype_files) + len(gmail_files) + \ len(odnoklassniki_files) + len(odnoklassniki_files_tam) + \ len(all_db_files) + len(sqlite_files) + len(rugram_files) self.log(Level.INFO, "Found " + str(numFiles) + " files") progressBar.switchToDeterminate(numFiles) if self.context.isJobCancelled(): return IngestModule.ProcessResult.OK if vk_files: vk(self, progressBar, vk_files) if kate_files: kate(self, progressBar, kate_files) if viber_calls_files: viber_calls(self, progressBar, viber_calls_files) if viber_messages_files: viber_messages(self, progressBar, viber_messages_files) if skype_files: skype(self, progressBar, skype_files) if gmail_files: gmail(self, progressBar, gmail_files) if aquamail_files: aquamail(self, progressBar, aquamail_files) if odnoklassniki_files: odnoklassniki(self, progressBar, odnoklassniki_files) if odnoklassniki_files_tam: odnoklassniki_tam(self, progressBar, odnoklassniki_files_tam) if rugram_files: rugram(self, progressBar, rugram_files) if self.local_settings.getSetting('Flag') == 'true': search_for_tables(self, progressBar, all_db_files, self.List_Of_Tables) search_for_tables(self, progressBar, sqlite_files, self.List_Of_Tables) all_social_app = ', '.join(self.social_app) if len(self.social_app) > 0: self.log( Level.INFO, "Обнаружены базы данных программного обеспечения: ".decode( 'UTF-8') + all_social_app) else: message = IngestMessage.createMessage( IngestMessage.MessageType.DATA, IMDbIngestModuleFactory.moduleName, "Поддерживаемых баз данных программного обеспечения не обнаружено" .decode('UTF-8')) IngestServices.getInstance().postMessage(message) self.log(Level.INFO, "Поддерживаемых баз данных не обнаружено".decode('UTF-8')) return IngestModule.ProcessResult.OK
""" import vk import csv """ Пользователь вводит название города """ Sity_name = raw_input("Enter sity name: ") print "Sity_name = ", Sity_name """ Используя API vk получаем идентификатор города Полагаем, что поиск осуществляем по городам России, потому соответственно ID страны указываем 1. """ rest = vk.vk() list_sity = rest.execute("database.getCities", 'cid', 'title', country_id='1', q=Sity_name, need_all='1', count ='10') """ Если идентификатор единственный, то используя е гоосуществляем поиск пользоватеей. Если идентификаторов несколько, то росим пользователя его уточнить. """ if len(list_sity) == 0: print "Город в базеданных Vkontakte не найден." exit(-1) Sity_ID = '0' if len(list_sity) > 1: print " ID Название города"
def onLogi5(self, event): vk() print("done") self.Close()
# Программирование на языке высокого уровня (Python). # Задание task_13_05_02. Вариант !!! # # Выполнил: Фамилия И.О. # Группа: !!! # E-mail: !!! import vk # https://oauth.vk.com/authorize?client_id=6104500&scope=friends&redirect_uri=http://oauth.vk.com/blank.html&display=page&response_type=token if __name__ == "__main__": v = vk.vk( "31908763", "a1752332c34ca17478a2938982f0ebc3e01a3cf55297c10d06ded262b098d8bcc7f9b50fbacca1033895f" ) v._load_info() print(v) v.show_plot()
deldb.commit() msgdb_cur.execute('DELETE FROM messages WHERE id=%d' % msgid) msgdb.commit() print(json.loads(msg)) def mrproper(): global mrproper_time if mrproper_time < 24 * 60**2: mrproper_time = time.time() cmd = 'DELETE FROM messages WHERE time < %d' % (int(time.time()) - 24 * 60**2) msgdb_cur.execute(cmd) msgdb.commit() print('mrproper: cleaning!') vkbot = vk.vk(token=info.token) def on_event(event): mrproper() if event[0] == 2: findbyid(event[1]) elif event[0] == 4: msg = vkbot.messages.getById(message_ids=event[1]).response.items[0] addtodb(msg) vkbot.lp_loop(on_event)
from vk import vk chats = vk('messages.getChat', {'chat_ids': ','.join(map(str, range(1, 73)))}) names = [] for chat in chats: if 53321 in chat['users']: names.append(chat['title']) print('Всего чатов: {}, чатов с Антоном: {}'.format(len(chats), len(names))) print('\n'.join(names))