private void DatabindDumpTab() { var dumpCmd = new DumpCommand(); dumpsourceProviderBox.DataBindings.Add("Text", dumpCmd, "sourceProvider", true, DataSourceUpdateMode.OnPropertyChanged); dumpsourcePathToPOBox.DataBindings.Add("Text", dumpCmd, "SourcePathToPOBox", true, DataSourceUpdateMode.OnPropertyChanged); _commands[Verb.dump] = dumpCmd; //dumpsourceProviderBox.SelectedIndex = 0; }
private static int RunDump(DumpCommand opts) { if (!TryReadFile(opts.DatabaseFile, out Stream stream, out Sqlite3Database db, out List <Sqlite3SchemaRow> tables)) { return(1); } throw new System.NotImplementedException(); }
static void Main(string[] args) { // always the first call to make Phlib.InitializePhLib(); int recursion_depth = 0; bool early_exit = false; bool show_help = false; bool export_as_json = false; DumpCommand command = null; OptionSet opts = new OptionSet() { { "h|help", "show this message and exit", v => show_help = v != null }, { "json", "Export results in json format", v => export_as_json = v != null }, { "d|depth=", "limit recursion depth when analyisng loaded modules or dependency chain. Default value is infinite", (int v) => recursion_depth = v }, { "knowndll", "List all known dlls", v => { DumpKnownDlls(GetObjectPrinter(export_as_json)); early_exit = true; } }, { "apisets", "List apisets redirections", v => { DumpApiSets(GetObjectPrinter(export_as_json)); early_exit = true; } }, { "apisetsdll", "List apisets redirections from apisetschema.dll", v => command = DumpApiSets }, { "manifest", "show manifest information embedded in PE file", v => command = DumpManifest }, { "sxsentries", "dump all of FILE's sxs dependencies", v => command = DumpSxsEntries }, { "imports", "dump FILE imports", v => command = DumpImports }, { "exports", "dump FILE exports", v => command = DumpExports }, { "chain", "dump FILE whole dependency chain", v => command = DumpDependencyChain }, { "modules", "dump FILE resolved modules", v => command = DumpModules }, }; List <string> eps = opts.Parse(args); if (early_exit) { return; } if ((show_help) || (args.Length == 0) || (command == null)) { DumpUsage(); return; } String FileName = eps[0]; //Console.WriteLine("[-] Loading file {0:s} ", FileName); PE Pe = new PE(FileName); if (!Pe.Load()) { Console.Error.WriteLine("[x] Could not load file {0:s} as a PE", FileName); return; } command(Pe, GetObjectPrinter(export_as_json), recursion_depth); }
private void TargetIf_AppProgressEvent(ProgressArgs arg) { int idx = _listItems.FindIndex(x => x.Id == arg.ImageID && (int)x.Protocol == arg.ExtraInfo); if (idx >= 0 && arg.TotalBytes > 0) // 유효한 파일 다운로드 중.. { int progress = (int)(arg.SentBytes * 100 / arg.TotalBytes); UpdateProgress(idx, progress); } else if (arg.ExtraInfo == (int)QProtocol.All) { if (_targetIf != null) { _targetIf.AppProgressEvent -= TargetIf_AppProgressEvent; } if (FbMode == FBMode.Download && arg.TotalBytes > 0) { Main.PrintImagesList(_listItems); } Log.i("All {0} is Completed.", FbMode == FBMode.Download ? "Download" : "Dump"); this.TotalStatus = string.Format("{0} is completed {1}.", FbMode == FBMode.Download ? "<download>" : "<dump>", arg.TotalBytes > 0 ? "successfully" : "but failed"); FbMode = FBMode.None; bool ok = arg.TotalBytes > 0; Pages.TopMessageBox.ShowMsg( string.Format("A task is completed.\n\n<Result>\n\t{0}", ok ? "Success" : "Fail - refer logs"), ok); this.UIThread(delegate { DownloadCommand.RaiseCanExecuteChanged(); DumpCommand.RaiseCanExecuteChanged(); }); } }
static void Main(string[] args) { CommandLineApplication application = new CommandLineApplication(true) { FullName = "Danbooru Downloader", }; application.HelpOption("-?|-h|--help"); CommandOption versionOption = application.VersionOption("-v|--version", PlatformServices.Default.Application.ApplicationVersion); application.Command("dump", command => { command.Description = "Download entire images on the server of specified source."; command.HelpOption("-h|--help"); CommandArgument outputPathArgument = command.Argument("path", "Output path.", false); CommandOption startIdOption = command.Option("-s|--start-id <id>", "Starting Id. Default is 1.", CommandOptionType.SingleValue); CommandOption ignoreHashCheckOption = command.Option("-i|--ignore-hash-check", "Ignore hash check.", CommandOptionType.NoValue); CommandOption includeDeletedOption = command.Option("-d|--deleted", "Include deleted posts.", CommandOptionType.NoValue); command.OnExecute(() => { string path = outputPathArgument.Value; long startId = 1; bool ignoreHashCheck = ignoreHashCheckOption.HasValue(); bool includeDeleted = includeDeletedOption.HasValue(); if (startIdOption.HasValue() && !long.TryParse(startIdOption.Value(), out startId)) { Console.WriteLine("Invalid start id."); return(-2); } DumpCommand.Run(path, startId, ignoreHashCheck, includeDeleted).Wait(); return(0); }); }); application.OnExecute(() => { application.ShowHint(); return(0); }); try { int exitCode = application.Execute(args); if (exitCode == -2) { application.ShowHint(); } Environment.ExitCode = exitCode; } catch (Exception e) { Console.WriteLine(e); Environment.ExitCode = -1; } }
static void Main(string[] args) { // always the first call to make Phlib.InitializePhLib(); int recursion_depth = 0; bool early_exit = false; bool show_help = false; bool export_as_json = false; bool use_bin_cache = false; DumpCommand command = null; OptionSet opts = new OptionSet() { { "h|help", "show this message and exit", v => show_help = v != null }, { "json", "Export results in json format", v => export_as_json = v != null }, { "cache", "load and use binary cache to prevent dll file locking", v => use_bin_cache = v != null }, { "d|depth=", "limit recursion depth when analysing loaded modules or dependency chain. Default value is infinite", (int v) => recursion_depth = v }, { "knowndll", "List all known dlls", v => { DumpKnownDlls(GetObjectPrinter(export_as_json)); early_exit = true; } }, { "apisets", "List apisets redirections", v => { DumpApiSets(GetObjectPrinter(export_as_json)); early_exit = true; } }, { "apisetsdll", "List apisets redirections from apisetschema <FILE>", v => command = DumpApiSets }, { "manifest", "show manifest information embedded in <FILE>", v => command = DumpManifest }, { "sxsentries", "dump all of <FILE>'s sxs dependencies", v => command = DumpSxsEntries }, { "imports", "dump <FILE> imports", v => command = DumpImports }, { "exports", "dump <FILE> exports", v => command = DumpExports }, { "assemblyrefs", "dump <FILE> assemblyrefs", v => command = DumpAssemblyReferences }, { "modulerefs", "dump <FILE> modulerefs", v => command = DumpModuleReferences }, { "chain", "dump <FILE> whole dependency chain", v => command = DumpDependencyChain }, { "modules", "dump <FILE> resolved modules", v => command = DumpModules }, }; List <string> eps = opts.Parse(args); if (early_exit) { return; } if ((show_help) || (args.Length == 0) || (command == null)) { DumpUsage(); return; } BinaryCache.InitializeBinaryCache(use_bin_cache); if (eps.Count == 0) { Console.Error.WriteLine("[x] Command {0:s} needs to have a PE <FILE> argument", command.Method.Name); Console.Error.WriteLine(""); DumpUsage(); return; } String FileName = eps[0]; if (!NativeFile.Exists(FileName)) { Console.Error.WriteLine("[x] Could not find file {0:s} on disk", FileName); return; } Debug.WriteLine("[-] Loading file {0:s} ", FileName); PE Pe = new PE(FileName); if (!Pe.Load()) { Console.Error.WriteLine("[x] Could not load file {0:s} as a PE", FileName); return; } command(Pe, GetObjectPrinter(export_as_json), recursion_depth); }