<s> import idaapi <EOL> import clipboard <EOL> import sark <EOL> def message ( * messages ) : <EOL> for msg in messages : <EOL> for line in msg . splitlines ( ) : <EOL> idaapi . msg ( "<STR_LIT>" . format ( line ) ) <EOL> def copy_current_address ( ) : <EOL> start , end = sark . get_selection ( ) <EOL> clipboard . copy ( "<STR_LIT>" . format ( start ) ) <EOL> def copy_current_file_offset ( ) : <EOL> """<STR_LIT>""" <EOL> start , end = sark . get_selection ( ) <EOL> try : <EOL> file_offset = sark . core . get_fileregion_offset ( start ) <EOL> clipboard . copy ( "<STR_LIT>" . format ( file_offset ) ) <EOL> except sark . exceptions . NoFileOffset : <EOL> message ( "<STR_LIT>" ) <EOL> def copy_current_selection ( ) : <EOL> start , end = sark . get_selection ( ) <EOL> buffer = sark . data . read_memory ( start , end ) <EOL> clipboard . copy ( buffer . encode ( "<STR_LIT>" ) ) <EOL> class QuickCopy ( idaapi . plugin_t ) : <EOL> flags = <NUM_LIT:0> <EOL> comment = "<STR_LIT>" <EOL> help = "<STR_LIT>" <EOL> wanted_name = "<STR_LIT>" <EOL> wanted_hotkey = "<STR_LIT>" <EOL> def init ( self ) : <EOL> self . hotkeys = [ ] <EOL> self . hotkeys . append ( idaapi . add_hotkey ( "<STR_LIT>" , copy_current_address ) ) <EOL> self . hotkeys . append ( idaapi . add_hotkey ( "<STR_LIT>" , copy_current_file_offset ) ) <EOL> self . hotkeys . append ( idaapi . add_hotkey ( "<STR_LIT>" , copy_current_selection ) ) <EOL> return idaapi . PLUGIN_KEEP <EOL> def term ( self ) : <EOL> for hotkey in self . hotkeys : <EOL> idaapi . del_hotkey ( hotkey ) <EOL> def run ( self , arg ) : <EOL> pass <EOL> def PLUGIN_ENTRY ( ) : <EOL> return QuickCopy ( ) </s>
