/// <inheritdoc /> public override string ToLS(bool indent = true) { var writer = new BlockWriter(GetType(), indent, Disabled); writer .Label(Label) .Token("PARSE") .Literal(ParseTarget) .Token(Type); switch (Type) { case ParseType.LR: writer .Literal(LeftString) .Literal(RightString) .Boolean(Recursive, "Recursive") .Boolean(UseRegexLR, "UseRegexLR"); break; case ParseType.CSS: writer .Literal(CssSelector) .Literal(AttributeName); if (Recursive) { writer.Boolean(Recursive, "Recursive"); } else { writer.Integer(CssElementIndex, "CssElementIndex"); } break; case ParseType.JSON: writer .Literal(JsonField) .Boolean(Recursive, "Recursive"); break; case ParseType.REGEX: writer .Literal(RegexString) .Literal(RegexOutput) .Boolean(Recursive, "Recursive"); break; } writer .Arrow() .Token(IsCapture ? "CAP" : "VAR") .Literal(VariableName); if (!writer.CheckDefault(Prefix, "Prefix") || !writer.CheckDefault(Suffix, "Suffix")) { writer.Literal(Prefix).Literal(Suffix); } return(writer.ToString()); }
/// <inheritdoc /> public override string ToLS(bool indent = true) { var writer = new BlockWriter(GetType(), indent, Disabled); writer .Label(Label) .Token("TCP") .Token(TCPCommand); switch (TCPCommand) { case TCPCommand.Connect: writer .Literal(Host) .Literal(Port) .Boolean(UseSSL, "UseSSL"); break; case TCPCommand.Send: writer .Literal(Message); break; } if (!writer.CheckDefault(VariableName, "VariableName")) { writer .Arrow() .Token(IsCapture ? "CAP" : "VAR") .Literal(VariableName); } return(writer.ToString()); }
/// <inheritdoc /> public override string ToLS(bool indent = true) { var writer = new BlockWriter(GetType(), indent, Disabled); writer .Label(Label) .Token("KEYCHECK") .Boolean(BanOn4XX, "BanOn4XX") .Boolean(BanOnToCheck, "BanOnToCheck"); foreach (var kc in KeyChains) { writer .Indent(1) .Token("KEYCHAIN") .Token(kc.Type); if (kc.Type == KeyChain.KeychainType.Custom) { writer.Literal(kc.CustomType); } writer.Token(kc.Mode); foreach (var k in kc.Keys) { if (k.LeftTerm == "<SOURCE>" && k.Condition == Condition.Contains) { writer .Indent(2) .Token("KEY") .Literal(k.RightTerm); } else { writer .Indent(2) .Token("KEY") .Literal(k.LeftTerm) .Token(k.Condition); if (k.Condition != Condition.Exists) { writer.Literal(k.RightTerm); } } } } return(writer.ToString()); }
/// <inheritdoc /> public override string ToLS(bool indent = true) { var writer = new BlockWriter(GetType(), indent, Disabled); writer .Label(Label) .Token("CAPTCHA") .Literal(Url); if (UserAgent != "") { writer.Literal(UserAgent); } writer.Boolean(Base64, "Base64") .Boolean(SendScreenshot, "SendScreenshot") .Arrow() .Token("VAR") .Literal(VariableName); return(writer.ToString()); }
/// <inheritdoc /> public override string ToLS(bool indent = true) { var writer = new BlockWriter(GetType(), indent, Disabled); writer .Label(Label) .Token("SOLVECAPTCHA") .Token(Type); switch (Type) { case CaptchaType.TextCaptcha: writer .Literal(Question) .Token(LanguageGroup) .Token(Language); break; case CaptchaType.ImageCaptcha: writer .Literal(Base64) .Token(LanguageGroup) .Token(Language) .Integer(MinLength) .Integer(MaxLength) .Token(CharSet) .Literal(TextInstructions) .Boolean(IsPhrase, nameof(IsPhrase)) .Boolean(CaseSensitive, nameof(CaseSensitive)) .Boolean(RequiresCalculation, nameof(RequiresCalculation)); break; case CaptchaType.ReCaptchaV2: writer .Literal(SiteKey) .Literal(SiteUrl) .Boolean(IsInvisible, nameof(IsInvisible)); break; case CaptchaType.ReCaptchaV3: writer .Literal(SiteKey) .Literal(SiteUrl) .Literal(Action) .Literal(MinScore); break; case CaptchaType.FunCaptcha: writer .Literal(PublicKey) .Literal(ServiceUrl) .Boolean(NoJS, nameof(NoJS)); break; case CaptchaType.KeyCaptcha: writer .Literal(UserId) .Literal(SessionId) .Literal(WebServerSign1) .Literal(WebServerSign2); break; case CaptchaType.Capy: case CaptchaType.HCaptcha: writer .Literal(SiteKey) .Literal(SiteUrl); break; case CaptchaType.GeeTest: writer .Literal(SiteUrl) .Literal(GT) .Literal(Challenge) .Literal(ApiServer); break; } writer .Boolean(UseProxy, nameof(UseProxy)) .Literal(UserAgent, nameof(UserAgent)); return(writer.ToString()); }
/// <inheritdoc /> public override string ToLS(bool indent = true) { var writer = new BlockWriter(GetType(), indent, Disabled); writer .Label(Label) .Token("UTILITY") .Token(Group); switch (Group) { case UtilityGroup.List: writer .Literal(ListName) .Token(ListAction); switch (ListAction) { case ListAction.Join: writer .Literal(Separator); break; case ListAction.Sort: writer .Boolean(Ascending, "Ascending") .Boolean(Numeric, "Numeric"); break; case ListAction.Concat: case ListAction.Zip: case ListAction.Map: writer .Literal(SecondListName); break; case ListAction.Add: writer .Literal(ListItem) .Literal(ListIndex); break; case ListAction.Remove: writer .Literal(ListIndex); break; case ListAction.RemoveValues: writer .Token(ListElementComparer) .Literal(ListComparisonTerm); break; } break; case UtilityGroup.Variable: writer .Literal(VarName) .Token(VarAction); switch (VarAction) { case VarAction.Split: writer .Literal(SplitSeparator); break; } break; case UtilityGroup.Conversion: writer .Token(ConversionFrom) .Token(ConversionTo) .Literal(InputString); break; case UtilityGroup.File: writer .Literal(FilePath) .Token(FileAction); switch (FileAction) { case FileAction.Write: case FileAction.WriteLines: case FileAction.Append: case FileAction.AppendLines: case FileAction.Copy: case FileAction.Move: writer .Literal(InputString); break; } break; case UtilityGroup.Folder: writer .Literal(FolderPath) .Token(FolderAction); break; } if (!writer.CheckDefault(VariableName, "VariableName")) { writer .Arrow() .Token(IsCapture ? "CAP" : "VAR") .Literal(VariableName); } return(writer.ToString()); }
/// <inheritdoc /> public override string ToLS(bool indent = true) { var writer = new BlockWriter(GetType(), indent, Disabled); writer .Label(Label) .Token("FUNCTION") .Token(FunctionType); switch (FunctionType) { case Function.Hash: writer .Token(HashType); break; case Function.HMAC: writer .Token(HashType) .Literal(HmacKey) .Boolean(HmacBase64, "HmacBase64"); break; case Function.Translate: writer .Boolean(StopAfterFirstMatch, "StopAfterFirstMatch"); foreach (var t in TranslationDictionary) { writer .Indent() .Token("KEY") .Literal(t.Key) .Token("VALUE") .Literal(t.Value); } writer .Indent(); break; case Function.DateToUnixTime: writer .Literal(DateFormat, "DateFormat"); break; case Function.Replace: writer .Literal(ReplaceWhat) .Literal(ReplaceWith) .Boolean(UseRegex, "UseRegex"); break; case Function.RegexMatch: writer .Literal(RegexMatch, "RegexMatch"); break; case Function.RandomNum: writer .Integer(RandomMin) .Integer(RandomMax); break; case Function.CountOccurrences: writer .Literal(StringToFind); break; case Function.CharAt: writer .Literal(CharIndex); break; case Function.Substring: writer .Literal(SubstringIndex) .Literal(SubstringLength); break; case Function.RSA: writer .Literal(RSAMod) .Literal(RSAExp); break; } writer .Literal(InputString, "InputString"); if (!writer.CheckDefault(VariableName, "VariableName")) { writer .Arrow() .Token(IsCapture ? "CAP" : "VAR") .Literal(VariableName); } return(writer.ToString()); }
/// <inheritdoc /> public override string ToLS(bool indent = true) { var writer = new BlockWriter(GetType(), indent, Disabled); writer .Label(Label) .Token("REQUEST") .Token(Method) .Literal(Url) .Boolean(AcceptEncoding, "AcceptEncoding") .Boolean(AutoRedirect, "AutoRedirect") .Boolean(ReadResponseSource, "ReadResponseSource") .Boolean(ParseQuery, "ParseQuery") .Boolean(EncodeContent, "EncodeContent") .Token(RequestType, "RequestType") .Indent(); switch (RequestType) { case RequestType.BasicAuth: writer .Token("USERNAME") .Literal(AuthUser) .Token("PASSWORD") .Literal(AuthPass) .Indent(); break; case RequestType.Standard: if (!writer.CheckDefault(PostData, "PostData")) { writer .Token("CONTENT") .Literal(PostData) .Indent() .Token("CONTENTTYPE") .Literal(ContentType); } break; case RequestType.Multipart: foreach (var c in MultipartContents) { writer .Indent() .Token($"{c.Type.ToString().ToUpper()}CONTENT"); if (c.Type == MultipartContentType.String) { writer.Literal($"{c.Name}: {c.Value}"); } else if (c.Type == MultipartContentType.File) { writer.Literal($"{c.Name}: {c.Value}: {c.ContentType}"); } } if (!writer.CheckDefault(MultipartBoundary, "MultipartBoundary")) { writer .Indent() .Token("BOUNDARY") .Literal(MultipartBoundary); } break; } foreach (var c in CustomCookies) { writer .Indent() .Token("COOKIE") .Literal($"{c.Key}: {c.Value}"); } foreach (var h in CustomHeaders) { writer .Indent() .Token("HEADER") .Literal($"{h.Key}: {h.Value}"); } if (ResponseType == ResponseType.File) { writer .Indent() .Arrow() .Token("FILE") .Literal(DownloadPath); } return(writer.ToString()); }
/// <inheritdoc /> public override string ToLS(bool indent = true) { var writer = new BlockWriter(GetType(), indent, Disabled); writer .Label(Label) .Token("FUNCTION") .Token(FunctionType); switch (FunctionType) { case Function.Hash: writer .Token(HashType); break; case Function.HMAC: writer .Token(HashType) .Literal(HmacKey) .Boolean(HmacBase64, "HmacBase64") .Boolean(KeyBase64, "KeyBase64"); break; case Function.Translate: writer .Boolean(StopAfterFirstMatch, "StopAfterFirstMatch"); foreach (var t in TranslationDictionary) { writer .Indent() .Token("KEY") .Literal(t.Key) .Token("VALUE") .Literal(t.Value); } writer .Indent(); break; case Function.UnixTimeToDate: case Function.DateToUnixTime: writer .Literal(DateFormat); break; case Function.Replace: writer .Literal(ReplaceWhat) .Literal(ReplaceWith) .Boolean(UseRegex, "UseRegex"); break; case Function.RegexMatch: writer .Literal(RegexMatch, "RegexMatch"); break; case Function.RandomNum: writer .Literal(RandomMin) .Literal(RandomMax) .Boolean(RandomZeroPad, "RandomZeroPad"); break; case Function.CountOccurrences: writer .Literal(StringToFind); break; case Function.CharAt: writer .Literal(CharIndex); break; case Function.Substring: writer .Literal(SubstringIndex) .Literal(SubstringLength); break; case Function.RSAEncrypt: writer .Literal(RsaN) .Literal(RsaE) .Boolean(RsaOAEP, "RsaOAEP"); break; /* * case Function.RSADecrypt: * writer * .Literal(RsaN) * .Literal(RsaD) * .Boolean(RsaOAEP, "RsaOAEP"); * break; */ case Function.RSAPKCS1PAD2: writer .Literal(RsaN) .Literal(RsaE); break; case Function.GetRandomUA: if (UserAgentSpecifyBrowser) { writer .Token("BROWSER") .Token(UserAgentBrowser); } break; case Function.AESDecrypt: case Function.AESEncrypt: writer .Literal(AesKey) .Literal(AesIV) .Token(AesMode) .Token(AesPadding); break; case Function.PBKDF2PKCS5: if (KdfSalt != string.Empty) { writer.Literal(KdfSalt); } else { writer.Integer(KdfSaltSize); } writer .Integer(KdfIterations) .Integer(KdfKeySize) .Token(KdfAlgorithm); break; } writer .Literal(InputString, "InputString"); if (!writer.CheckDefault(VariableName, "VariableName")) { writer .Arrow() .Token(IsCapture ? "CAP" : "VAR") .Literal(VariableName); } return(writer.ToString()); }
/// <inheritdoc /> public override string ToLS(bool indent = true) { var writer = new BlockWriter(GetType(), indent, Disabled); writer .Label(Label) .Token("REQUEST") .Token(Method) .Literal(Url) .Boolean(AcceptEncoding, "AcceptEncoding") .Boolean(AutoRedirect, "AutoRedirect") .Boolean(ReadResponseSource, "ReadResponseSource") .Boolean(EncodeContent, "EncodeContent") .Token(RequestType, "RequestType") .Indent(); switch (RequestType) { case RequestType.BasicAuth: writer .Token("USERNAME") .Literal(AuthUser) .Token("PASSWORD") .Literal(AuthPass) .Indent(); break; case RequestType.Standard: if (HttpRequest.CanContainRequestBody(method)) { writer .Token("CONTENT") .Literal(PostData) .Indent() .Token("CONTENTTYPE") .Literal(ContentType); } break; case RequestType.Multipart: foreach (var c in MultipartContents) { writer .Indent() .Token($"{c.Type.ToString().ToUpper()}CONTENT"); if (c.Type == MultipartContentType.String) { writer.Literal($"{c.Name}: {c.Value}"); } else if (c.Type == MultipartContentType.File) { writer.Literal($"{c.Name}: {c.Value}: {c.ContentType}"); } } if (!writer.CheckDefault(MultipartBoundary, "MultipartBoundary")) { writer .Indent() .Token("BOUNDARY") .Literal(MultipartBoundary); } break; case RequestType.Raw: if (HttpRequest.CanContainRequestBody(method)) { writer .Token("RAWDATA") .Literal(RawData) .Indent() .Token("CONTENTTYPE") .Literal(ContentType); } break; } if (SecurityProtocol != SecurityProtocol.SystemDefault) { writer .Indent() .Token("SECPROTO") .Token(SecurityProtocol, "SecurityProtocol"); } foreach (var c in CustomCookies) { writer .Indent() .Token("COOKIE") .Literal($"{c.Key}: {c.Value}"); } foreach (var h in CustomHeaders) { writer .Indent() .Token("HEADER") .Literal($"{h.Key}: {h.Value}"); } if (ResponseType == ResponseType.File) { writer .Indent() .Arrow() .Token("FILE") .Literal(DownloadPath) .Boolean(SaveAsScreenshot, "SaveAsScreenshot"); } else if (ResponseType == ResponseType.Base64String) { writer .Indent() .Arrow() .Token("BASE64") .Literal(OutputVariable); } return(writer.ToString()); }
/// <inheritdoc/> public override string ToLS(bool indent = true) { BlockWriter writer = new BlockWriter(GetType(), indent, Disabled); writer.Label(Label) .Token("WS") .Token(Command); switch (Command) { case WSCommand.Connect: { writer.Literal(Url); if (Redirection) { writer.Boolean(Redirection, nameof(Redirection)); } if (EmitOnPing) { writer.Boolean(EmitOnPing, nameof(EmitOnPing)); } if (Credentials) { writer.Boolean(Credentials, nameof(Credentials)); } WriteVarOrCap(writer); if (Credentials) { writer.Indent() .Token("USERNAME") .Token(Username, nameof(Username)); writer.Indent() .Token("PASSWORD") .Token(Password, nameof(Password)); if (PreAuth) { writer.Indent() .Token("PREAUTH") .Token(PreAuth, nameof(PreAuth)); } } if (SslProtocols != SslProtocols.Default) { writer.Indent() .Token("SSLPROTO") .Token(SslProtocols, nameof(SslProtocols)); } if (Compression != CompressionMethod.None) { writer.Indent() .Token("COMPRESSION") .Token(Compression, nameof(Compression)); } foreach (var c in CustomCookies) { writer.Indent() .Token("COOKIE") .Literal($"{c.Key}: {c.Value}"); } } break; case WSCommand.Send: { writer.Literal(Message); WriteVarOrCap(writer); } break; default: WriteVarOrCap(writer); break; } return(writer.ToString()); }