private void cleanBlob(string ipRaw,string filetype, string filelocation,string mode){ lock(nikto_FP){ lock(backend_FP){ FPdata item = new FPdata(); item.filetype = filetype; item.host=ipRaw; item.URLlocation=filelocation; if (mode.Equals("directory")){ backend_FP.Remove(item); } if (mode.Equals("file")){ nikto_FP.Remove(item); } } } }
private string generateBlob (string target, string port, niktoRequests niktoset, string filetype, string filelocation,string header){ niktoRequests FPtest; FPtest.method=niktoset.method; FPtest.description="FP test item"; FPtest.type="FP test item"; FPtest.trigger=""; FPtest.isSSL=niktoset.isSSL; string result=""; if (niktoset.type.Equals("FPtestdir")==false){ FPtest.request=filelocation + "noteverthere." + filetype; } else FPtest.request=filelocation + "noteverthere/"; if (niktoset.isSSL){ result=stestNiktoRequest(target,port,buildNiktoRequest(FPtest,header),FPtest,6000,true); } else { result=stestNiktoRequest(target,port,buildNiktoRequest(FPtest,header),FPtest,6000,false); } //actually..this is the only place we really need to lock lock (backend_FP){ lock (nikto_FP){ FPdata item = new FPdata(); item.URLlocation=filelocation; item.method=FPtest.method; item.filetype=filetype; item.host=target; if (niktoset.type.CompareTo("FPtestfile")==0 || niktoset.type.CompareTo("FPtestdir")==0){ if (backend_FP.Contains(item)==false){ backend_FP.Add(item,result); } }else{ if (nikto_FP.Contains(item)==false){ nikto_FP.Add(item,result); } } } } return result; }
private string getBlob (string ipRaw, string portRaw, niktoRequests niktoset, string filetype, string filelocation,string header){ lock (this){ FPdata entry = new FPdata(); entry.filetype=filetype; entry.host=ipRaw; entry.method=niktoset.method; entry.URLlocation=filelocation; if (niktoset.type.CompareTo("FPtestfile")==0 || niktoset.type.CompareTo("FPtestdir")==0){ //check if it exists if (backend_FP.Contains(entry)){ return (string)backend_FP[entry]; } } else { if (nikto_FP.Contains(entry)){ return (string)nikto_FP[entry]; } } } //if we end up here we know we must go get a new one return generateBlob(ipRaw,portRaw,niktoset,filetype,filelocation,header); }