Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def inject_input(injection_type, arg):
try:
if injection_type == 'ty':
if not arg:
s.sendall('[-]Supply a key as an arg'+End)
return
pyautogui.typewrite(arg)
s.sendall('[+]Injected typewritten character/s' + End)
elif injection_type == 'pr':
if not arg:
s.sendall('[-]Supply a key as an arg'+End)
return
pyautogui.press(arg)
s.sendall('[+]Injected pressed key' + End)
elif injection_type == 'sh':
if not arg:
s.sendall('[-]Supply a key as an arg'+End)
return
if ' ' in arg:
arg = arg.split(' ')
for key in arg:
pyautogui.keyDown(key)
for key in reversed(arg):
pyautogui.keyUp(key)
s.sendall('[+]Injected keyboard shortcut' + End)
else:
pyautogui.hotkey(arg)
s.sendall('[+]Injected keyboard shortcut' + End)
elif injection_type == 'valids':
pyautogui.click()
# type in item
random_typer(str(ge_slot.item.item_name))
wait_for(ge_slot.item.image_in_ge_search, runescape_window)
# click item
move_mouse_to_image_within_region(ge_slot.item.image_in_ge_search, runescape_window)
pyautogui.click()
# click price box
coords_of_price_box = pointfrombox.random_point((runescape_window.bottom_right_corner[0]-384, runescape_window.bottom_right_corner[1]-272),
(runescape_window.bottom_right_corner[0]-291, runescape_window.bottom_right_corner[1]-259))
realmouse.move_mouse_to(coords_of_price_box[0], coords_of_price_box[1])
pyautogui.click()
time.sleep(random.random()+1)
# type in correct price and hit enter
random_typer(str(ge_slot.item.price_instant_sold_at))
pyautogui.press('enter')
# click quantity box
move_mouse_to_image_within_region("Tools/screenshots/quantity_box.png", runescape_window)
pyautogui.click()
time.sleep(random.random()+2)
# type in correct quantity and hit enter
ge_slot.item.set_quantity_to_buy(int(min(ge_slot.item.number_available_to_buy, (runescape_window.money/ge_slot.item.price_instant_sold_at)/runescape_window.number_of_empty_ge_slots)))
runescape_window.update_money(runescape_window.money - (ge_slot.item.quantity_to_buy*ge_slot.item.price_instant_sold_at))
random_typer(str(ge_slot.item.quantity_to_buy))
time.sleep(random.random())
pyautogui.press('enter')
# click confirm off
move_mouse_to_image_within_region("Tools/screenshots/confirm_offer_button.png", runescape_window)
pyautogui.click()
ge_slot.item.set_time_item_buy_was_placed()
wait_for('Tools/screenshots/lent_item_box.png', runescape_window)
# update states accordingly
def calibrate_dota_client():
gui.press('\\', pause=PAUSE)
gui.typewrite('sv_cheats 1', interval=TYPEWRITE_INT)
gui.press('enter', pause=PAUSE)
gui.typewrite('host_timescale 5', interval=TYPEWRITE_INT)
gui.press('enter', pause=PAUSE)
gui.press('\\', pause=PAUSE)
def pressAction(self, key):
print( "----------> PRESSING " + key )
pyautogui.press( key )
player = request.json.get('player', {})
round = request.json.get('round', {})
if player['steamid'] != mySteamID or player['state']['health'] == 0 or round['phase'] in ('freezetime','warmup','over'):
lastCheck = 'PlayMusic'
else:
lastCheck = 'StopPlaying'
if lastCheck == 'PlayMusic' and state == 'StopPlaying':
print(lastCheck)
sleep(deathDelay)
pyautogui.press('playpause')
state = lastCheck
elif lastCheck != state:
print(lastCheck)
pyautogui.press('playpause')
state = lastCheck
def press_ability( self, key ):
print( "pressing " + key )
press( key )
def keep_delete_model(key='k'):
import pyautogui
click(200, 1300)
# click(80, 1020)
pyautogui.press(key)
pyautogui.press('enter')
def do_keypress(img, center, row_keys_points):
# this fuction presses a key and marks the pressed key with blue color
for row in row_keys_points:
arr1 = list(np.int0(np.array(center) >= np.array(row[1]))) # center of the contour has greater value than the top left corner point of a key
arr2 = list(np.int0(np.array(center) <= np.array(row[2]))) # center of the contour has less value than the bottom right corner point of a key
if arr1 == [1, 1] and arr2 == [1, 1]:
if row[0] == '<-':
gui.press('backspace')
else:
gui.press(row[0])
cv2.fillConvexPoly(img, np.array([np.array(row[1]), \
np.array([row[1][0], row[2][1]]), \
np.array(row[2]), \
np.array([row[2][0], row[1][1]])]), \
(255, 0, 0))
return img
board.backGroundColor(0, 0, 0)
board.textBackColor(0, 0, 0)
board.setFont(Font.peanut)
board.rotateDisplay(board.rotate_0)
board.penColor(255, 255, 0)
board.drawText('REMOTE CONTROL', 50, 140)
rc1 = 0
rc2 = 0
while True:
board.getSensorData()
rc1 = board.RemoteCode
if (rc1 != 0) or (rc1 == rc2):
board.drawText(rc1, 50, 160)
#volume up
if rc1 == '4BB0':
pyautogui.press('volumeup')
board.ledWrite(Red, On)
#volume down
elif rc1 == '5BA0':
pyautogui.press('volumedown')
board.ledWrite(Green, On)
#backspace
elif rc1 == '9C60':
pyautogui.press('space')
board.ledWrite(Blue, On)
#right
elif rc1 == 'AC50':
pyautogui.press('right')
board.ledWrite(Green, On)
#left
elif rc1 == '8C70':
pyautogui.press('left')
for i in range(0, self.__j.get_numaxes()):
out[it] = self.__j.get_axis(i)
if(-0.80.9):
pyautogui.press('right')
self.key_debounce()
if(out[3]>0.9):
pyautogui.press('down')
self.key_debounce()
if(out[2]<-0.9):
pyautogui.press('left')
self.key_debounce()
if(out[3]<-0.9):
pyautogui.press('up')
self.key_debounce()
for i in range(0,self.__j.get_numhats()):
dire=self.__j.get_hat(i)
#Read input from buttons
for i in range(0, self.__j.get_numbuttons()):
out[it] = self.__j.get_button(i)
it+=1
if(out[8]):
if(not self.__pressed_s_c[0]):