def get_jobdetails(job_details):
    """
    Function to help pull only required information from a specified redis job
    description string.
    job_details: str
                string returned from rq.job.description

    Returns
    ------
    deets_dict: dictionary
                only the specified job details are returned

    """
    deets_dict = {}
    if 'Benchmark' in job_details:
        deet_match_list = [
            'name',
            'benchmark',
            'benchmark_all'
            ]
    else:
        deet_match_list = [
            'hash_mode',
            'attack_mode',
            'mask',
            'wordlist',
            'wordlist2',
            'rules',
            'name',
            'username',
            'increment',
            'increment_min',
            'increment_max',
            'disable_brain',
            'brain_check',
            'restore']
    ###***make this less ugly
    ###***review stripping here for improvement
    logger.debug('Parsing job details:\n{}'.format(job_details))
    # Process rules list separately as workaround for splitting on comma
    if '[' in job_details:
        ###***add mask_file here when updating to allow list of files
        rules_split = job_details[job_details.rfind('[')+1:job_details.rfind(']')].strip()
        rules_list = [rule.strip().rstrip("'").lstrip("'") for rule in rules_split.split(',')]
    else:
        rules_list = None
    deets_split = job_details[job_details.rfind('(')+1:job_details.rfind(')')].split(',')
    for deets in deets_split:
        deet = deets.split('=')[0].strip(' ')
        if deet in deet_match_list:
            deets_dict[deet] = deets.strip().split('=')[1].strip().rstrip("'").lstrip("'")
    if 'Benchmark' in job_details:
        return deets_dict
    if rules_list:
        rule_names = []
        for key, rule in dict(CRACK_CONF['rules']).items():
            if rule in rules_list:
                rule_names.append(key)
        deets_dict['rules'] = rule_names
    else:
        deets_dict['rules'] = None
    if 'mask' in deets_dict:
        if deets_dict['mask']:
            mask = deets_dict['mask']
            for key, mask_file in dict(CRACK_CONF['masks']).items():
                if mask in mask_file:
                    deets_dict['mask'] = key
    if 'wordlist' in deets_dict:
        if deets_dict['wordlist']:
            wordlist = deets_dict['wordlist']
            for key, word in dict(CRACK_CONF['wordlists']).items():
                if wordlist in word:
                    deets_dict['wordlist'] = key
                    break
                else:
                    deets_dict['wordlist'] = None
    if 'wordlist2' in deets_dict:
        wordlist = deets_dict['wordlist2']
        for key, word in dict(CRACK_CONF['wordlists']).items():
            if wordlist in word:
                deets_dict['wordlist2'] = key
                break
            else:
                deets_dict['wordlist2'] = None
    return deets_dict

    Function to help pull only required information from a specified redis job
    description string.
    job_details: str
                string returned from rq.job.description

    Returns
    ------
    deets_dict: dictionary
                only the specified job details are returned

    
crackq/cq_api.py