Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion emulator_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def check_avd_booted_completely(emulator_port) -> str:
def get_name(uid):
path = os.getcwd() + '/temp/' + uid + '/' + uid + '/context'
with open(path, 'r') as f:
first_line = f.readline()
first_line = f.readline(5_000_000)
return first_line


Expand Down
7 changes: 4 additions & 3 deletions fuzz_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
'''
import time
from typing import List, Union, Type
import random
from adb_logcat import FatalWatcher

from emulator import Emulator
Expand All @@ -19,6 +18,8 @@
from interval_event import IntervalEvent

import os
import secrets

dir = os.path.dirname(__file__)
StopFlagWatcher = os.path.join(dir, 'test/StopFlagWatcher')
ContextEventLog = os.path.join(dir, 'test/ContextEventLog')
Expand Down Expand Up @@ -71,7 +72,7 @@ def __init__(self, interval_minimum: int,
self.duration = int(duration)
self.uniform_interval = int(uniform_interval)
self.fatal_watcher = fatal_watcher
random.seed(self.seed)
secrets.SystemRandom().seed(self.seed)
# self.__setup_intervals(uniform_interval)
# self.__setup_interval_events()

Expand Down Expand Up @@ -137,7 +138,7 @@ def __random_value_generator(self, lower_limit: int, upper_limit: int):
raise ValueError("lower_limit must be int")
if not isinstance(upper_limit, int):
raise ValueError("upper_limit must be int")
return random.randint(lower_limit, upper_limit)
return secrets.SystemRandom().randint(lower_limit, upper_limit)

# def duration_interval_steps_generator(self)->List[int]:
# '''
Expand Down
6 changes: 3 additions & 3 deletions mobicomonkey.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from xml_element import XML_Element
from adb_settings import AdbSettings
from telnet_connector import TelnetAdb
import random
from typing import List
from threading import Thread
from adb_settings import KeyboardEvent
Expand All @@ -16,6 +15,7 @@
import monkey
from adb_logcat import Logcat, TestType
import mutex
import secrets

dir = os.path.dirname(__file__)
eventFile = os.path.join(dir, 'test/EventLog')
Expand Down Expand Up @@ -238,9 +238,9 @@ def traverse_elements(activity: str, element_list: List[XML_Element],
def input_key_event(activity: str, item: XML_Element,
emulator: Emulator, adb_settings: AdbSettings):
api_commands.adb_input_tap(emulator, item.xpos, item.ypos)
rand = random.randint(config.MINIMUM_KEYEVENT, config.MAXIMUM_KEYEVENT)
rand = secrets.SystemRandom().randint(config.MINIMUM_KEYEVENT, config.MAXIMUM_KEYEVENT)
for i in range(rand):
KeyCode = KeyboardEvent(random.randint(0, 40)).name
KeyCode = KeyboardEvent(secrets.SystemRandom().randint(0, 40)).name
print("Sending event " + KeyCode)
adb_settings.adb_send_key_event_test(KeyCode)
eventlog.write(util.return_current_time_in_logcat_style() + '\t' +
Expand Down