Anadvancedpersistentthreat(APT)isanetworkattackduringwhichanunauthorizedpersonobtainsaccesstoanetworkandstaysthereundetectedforalongperiodoftime.APTattacksaredifficulttoidentifybecauseoftheircompletelyinvisibility.Inspiredbythedangertheoryinthebiologyimmunesystem,adangertheory basedreal-timeresponsemodelforAPTattacks waspresented.Someimportantdefinitionssuchasself,nonself,dangersignal,dangerantigen,antigenpresentingcellandimmunecellinthenetworkactivitiesweredefined.Thedynamicevolutionequationsofantigenpresentingcells,immunecells,andantigengenelibrarywereestablished.Thedangersignalconcentrationwasalsoused tocalculatetheantigendanger.Thetheoreticalanalysisandexperimentalresultsshowedthatthepresentedmodeleffectivelyovercomesthequantitativereal-timecalculationproblemofantigendanger,andhasmuchmoreadaptabilitythantraditionalmethodsforAPTattacksdetection.