The present invention is directed to a use of a heat shock protein inhibitor in preparing pharmaceutical composition for treating hepatitis by scavenging hepatitis B virus-infected cells. The heat shock protein inhibitor is selected from a group including VER-155008, Pifithrin-μ, and pharmaceutical acceptable salts thereof. The present invention is also directed to a use of a heat shock protein inhibitor in preparing pharmaceutical composition for treating hepatoma.