Ejemplo n.º 1
0
        static void SqlmapScanner(string[] args)
        {
            using (SqlmapSession session = new SqlmapSession("127.0.0.1", 8775))
            {
                using (SqlmapManager manager = new SqlmapManager(session))
                {
                    string taskid = manager.NewTask();

                    Dictionary <string, object> options = manager.GetOptions(taskid);
                    options["url"]          = args[0];
                    options["flushsession"] = true;

                    manager.StartTask(taskid, options);

                    SqlmapStatus status = manager.GetScanStatus(taskid);
                    while (status.Status != "terminated")
                    {
                        System.Threading.Thread.Sleep(new TimeSpan(0, 0, 10));
                        status = manager.GetScanStatus(taskid);
                    }

                    List <SqlmapLogItem> logItems = manager.GetLog(taskid);
                    foreach (SqlmapLogItem item in logItems)
                    {
                        Console.WriteLine(item.Message);
                    }

                    manager.DeleteTask(taskid);
                }
            }
        }
Ejemplo n.º 2
0
        public SqlmapStatus GetScanStatus(string taskid)
        {
            JObject tok = JObject.Parse(_session.ExecuteGet("/scan/" + taskid + "/status"));

            SqlmapStatus stat = new SqlmapStatus();

            stat.Status = (string)tok["status"];

            if (tok["returncode"].Type != JTokenType.Null)
            {
                stat.ReturnCode = (int)tok["returncode"];
            }

            return(stat);
        }