Inclusion Criteria:  Age ≥18 years Evidence of primary or recurrent high-grade gliomas (HGG) that in the opinion of the treating team would require surgical resection Karnofsky Performance Score (KPS) ≥ 60% Eastern Cooperative Oncology Group (ECOG) performance status ≤ 2 Life expectancy greater than 12 weeks Adequate liver function defined as Alanine aminotransferase (ALT),Aspartate transaminase (AST), Alkaline phosphatase (ALP) within 1.5x institutional upper limit of normal Adequate renal function defined as estimated glomerular filtration rate (eGFR) levels within 1.5x the institutional upper limit of normal Ability to swallow medication Women of child-bearing potential and men must agree to use adequate contraception (hormonal or barrier method of birth control; abstinence) for the duration of study participation. Ability to understand and willingness to sign a written informed consent document Be able to comply with treatment plan, study procedures and follow-up examinations  Exclusion Criteria:  Patients may not be receiving any other investigational agents while on study Patients who have known allergy to ketoconazole or other azoles Patients who have previously had a severe side effect, such as agranulocytosis and neutropenia, in conjunction with previous azole class drugs for a parasitic infection Patients with a history of acute or chronic hepatitis Patients with liver enzymes (ALT, AST, ALP) >1.5x above normal range for the laboratory performing the test Patients who are taking metronidazole and cannot be safely moved to a different antibiotic greater than 7 days prior to starting ketoconazole therapy Patients who are taking any anti-convulsant medication that interferes with the cytochrome P450 pathway (e.g. phenytoin, phenobarbital, carbamazepine, etc.) and who cannot be switched to alternative medications such as keppra (levetiracetam) Uncontrolled intercurrent illness such as chronic hepatitis, acute hepatitis, or psychiatric illness/social situation that would limit compliance with study requirements Patients with a history of Addison's disease or other forms of adrenal insufficiency Patient with little or no stomach acid production (achlorhydria) Pregnant and breast feeding women Patients with a history of any medical or psychiatric condition or laboratory abnormality that in the opinion of the investigator may increase the risks associated with the study participation or investigational product administration or may interfere with the interpretation of the results. Patients who are not available for follow-up assessments or unable to comply with study requirements. Patients who are currently taking medications that induce the metabolism of ketoconazole, such as isoniazid, nevirapine, rifamycins (such as rifabutin, rifampin), or St. John's wort and cannot be safely discontinued off of them for the duration of the trial. Patients who are currently taking medications for which the metabolism may be affected by ketoconazole, which include but are not limited to: benzodiazepines (such as alprazolam, midazolam, triazolam), domperidone, eletriptan, eplerenone, ergot drugs (such as ergotamine), nisoldipine, drugs used to treat erectile dysfunction (ED) or pulmonary hypertension (such as sildenafil, tadalafil), some drugs used to treat seizures (such as carbamazepine, phenytoin), some statin drugs (such as atorvastatin, lovastatin, simvastatin). Patients who are non-English speakers Patients who are not capable of understanding the consent form and would need a legally authorized representative.