#!/usr/bin/python3

import json
import _dynStruct
import argparse

def get_args():
    parser = argparse.ArgumentParser(description='Dynstruct analize tool')
    parser.add_argument('-d', type=str, dest='dynamo_file',
                        help='output file from dynStruct dynamoRio client')
    parser.add_argument('-w', type=str, dest='previous_file',
                        help='file generated by a previous use of the web ui')
    parser.add_argument('-o', type=str, dest='out_file',
                        help='name of the file generate by web ui')
    parser.add_argument('-e', type=str, default=None, dest='out_file',
                        metavar='<file_name>',
                        help='export structures in C style on <file_name>')
    parser.add_argument('-c', action='store_true', dest='console',
                        help='print structures in C style on console')
    parser.add_argument('-n', action='store_false', dest='web_view',
                        help='print structures in C style on console')

    return parser.parse_args()
    
def main():
    args = get_args()
    # if dynamo_file => load json + recover struct for each block
    # if previsou_file => load serialazed data
    # if out_file write header C like with all struct and quit
    # if console header C like on console with all struct and quit
    # if out_file open and set as global (each change on structs will rewrite this file)
    # if web_view start web view alse quit
    
    
if __name__ == '__main__':
    main()

#!/usr/bin/python3

import json
import _dynStruct
import argparse

def get_args():
    parser = argparse.ArgumentParser(description='Dynstruct analize tool')
    parser.add_argument('-d', type=str, dest='dynamo_file',
                        help='output file from dynStruct dynamoRio client')
    parser.add_argument('-w', type=str, dest='previous_file',
                        help='file generated by a previous use of the web ui')
    parser.add_argument('-o', type=str, dest='out_file',
                        help='name of the file generate by web ui')
    parser.add_argument('-e', type=str, default=None, dest='out_file',
                        metavar='<file_name>',
                        help='export structures in C style on <file_name>')
    parser.add_argument('-c', action='store_true', dest='console',
                        help='print structures in C style on console')
    parser.add_argument('-n', action='store_false', dest='web_view',
                        help='print structures in C style on console')
    parser.add_argument('-l', dest='bind_addr', default='127.0.0.1', type=str,
                        help='addr where the web view will listen,\
                        default 127.0.0.1')

    return parser.parse_args()
    
def main():
    args = get_args()
    # if dynamo_file => load json + recover struct for each block
    # if previsou_file => load serialazed data
    # if out_file write header C like with all struct and quit
    # if console header C like on console with all struct and quit
    # if out_file open and set as global (each change on structs will rewrite this file)
    # if web_view start web view alse quit, bind it on bind_addr
    
    
if __name__ == '__main__':
    main()

add bind addr option for the web view in args