-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 611c4a3
Showing
48 changed files
with
47,654 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
__history/ | ||
*.dcu | ||
*.~pas | ||
*.~* | ||
Thumbs.db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Syhunt and Sandcat are registered trademarks of Syhunt Informatica. | ||
Other brands and trademarks are the property of their respective owners. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
Copyright (c) 2003-2014, Syhunt Informatica | ||
Portions copyright (c) 2003-2014, Felipe Daragon | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
* Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
* Neither the name, trademarks or logos of Syhunt nor the names of its | ||
contributors may be used to endorse or promote products derived from this | ||
software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Catarinka | ||
|
||
Catarinka is a set of visual and non-visual components, and methods for Pascal/Delphi, developed as part of the [Sandcat Browser](https://github.com/felipedaragon/sandcat) project. This kit includes the following components: | ||
|
||
* `TCatChromium` - A web browser component built on top of DCEF3. | ||
* `TCatConsole` - Console component built on top of a modified version of the Console component by Michael Elsdörfer. | ||
* `TCatHighlighters` - Provides quick access to multiple SynEdit highlighters with a color scheme adapted from the CodeRay project. | ||
* `TCatHTMLParser` - HTML Parser based on a component by Przemyslaw Jankowski | ||
* `TCatJSON` - JSON Manipulation component built on top of the SuperObject. | ||
* `TCatListEditor` - A list editor based on SuperList by David Koretzky. | ||
* `TCatPreferences` - JSON-Based settings management component | ||
* `TCatStorage` - VFS/Cache component that uses the Structured Storage library by Primoz Gabrijelcic. | ||
* `TCatSynEdit` - Enhanced SynEdit with popup menu and improved scrolling. | ||
* `TJIniList` - INIList-Like component using JSON | ||
* `TStringLoop` - A simple component for looping through a string list | ||
* Several libraries with string manipulation functions, file system functions and more. | ||
|
||
## Compatibility | ||
|
||
All components here work with the latest Delphi releases (for both 32-bit and 64-bit compilation) and the older D7. Most of them may work with FPC and Lazarus. | ||
|
||
### Before Compiling | ||
|
||
CatPrefs: Rename the `src\CatDCPKey.pas` file, edit it and add your own encryption keys or key generators. | ||
|
||
## Dependencies | ||
|
||
* All included in the `src` directory, except the following which you need to download separately: | ||
* [DCPcrypt 2](https://bitbucket.org/wpostma/dcpcrypt2010) - needed by CatDCP. | ||
* [SynWeb 1.5](https://code.google.com/p/synweb/) and [SynEdit](http://sourceforge.net/projects/synedit/) - needed by CatSynEdit. | ||
* [Structured Storage](https://code.google.com/p/gpdelphiunits/) - need by CatStorage. | ||
* [Abbrevia 5.0](http://sourceforge.net/projects/tpabbrevia/) - needed by CatZIP. | ||
|
||
## License & Credits | ||
|
||
Catarinka was developed by Felipe Daragon, [Syhunt](http://www.syhunt.com/). | ||
|
||
This project is licensed under a 3-clause BSD license - see the LICENSE file for details. | ||
|
||
Some libraries and third-party code included with Catarinka use different licenses, such as MIT and MPL. You can find them in the comments of the source code files. | ||
|
||
## Contact | ||
|
||
Twitter: [@felipedaragon](https://twitter.com/felipedaragon), [@syhunt](https://twitter.com/syhunt) | ||
|
||
Email: felipe _at_ syhunt.com | ||
|
||
If you want to report a security bug, please see the `docs\SECURITY.md` file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Security | ||
|
||
Security bugs should be reported directly to [email protected]. Low risk security bugs can be reported by opening an issue here. If you are unsure about the risk level, please report it via email. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,199 @@ | ||
unit CatCEFCache; | ||
|
||
{ | ||
Catarinka - Chromium Cache Reader functions | ||
Copyright (c) 2013-2014 Syhunt Informatica | ||
License: 3-clause BSD | ||
See https://github.com/felipedaragon/catarinka/ for details | ||
} | ||
|
||
interface | ||
|
||
uses | ||
{$IF CompilerVersion >= 23} // XE2 or higher | ||
Winapi.Windows, System.Classes, System.SysUtils, Vcl.Dialogs; | ||
{$ELSE} | ||
Windows, Classes, SysUtils, Dialogs; | ||
{$IFEND} | ||
|
||
function ChromeCacheToString(const HTML: string): string; | ||
function GetChromeCacheResponseHeaders(const HTML: string): string; | ||
function GetChromeCacheRawData(const HTML: string): string; | ||
function IsContentGzipped(const HTML: string): boolean; | ||
procedure ChromeCacheExtract(const HTML, OutFilename: string); | ||
|
||
implementation | ||
|
||
uses | ||
CatHTTP, CatStringLoop, CatStrings, CatZIP; | ||
|
||
const | ||
cHexPos = '00000000:'; | ||
|
||
procedure SaveHexStringToFile(HexStr: string; DestFileName: string; | ||
gunzip: boolean = false); | ||
var | ||
BinaryStream: TMemoryStream; | ||
begin | ||
BinaryStream := TMemoryStream.Create; | ||
try | ||
BinaryStream.Size := Length(HexStr) div 2; | ||
if BinaryStream.Size > 0 then | ||
begin | ||
HexToBin({$IFDEF UNICODE}PAnsiChar{$ELSE}PChar{$ENDIF}(ansistring(HexStr)), BinaryStream.Memory, | ||
BinaryStream.Size); | ||
if gunzip then | ||
GUnZipStream(BinaryStream); | ||
BinaryStream.SaveToFile(DestFileName) | ||
end; | ||
finally | ||
BinaryStream.Free; | ||
end; | ||
end; | ||
|
||
function GUnzipHexStr(HexStr: string): string; | ||
var | ||
BinaryStream: TMemoryStream; | ||
res: TStringList; | ||
begin | ||
result := emptystr; | ||
res := TStringList.Create; | ||
BinaryStream := TMemoryStream.Create; | ||
try | ||
BinaryStream.Size := Length(HexStr) div 2; | ||
if BinaryStream.Size > 0 then | ||
begin | ||
HexToBin({$IFDEF UNICODE}PAnsiChar{$ELSE}PChar{$ENDIF}(ansistring(HexStr)), BinaryStream.Memory, | ||
BinaryStream.Size); | ||
GUnZipStream(BinaryStream); | ||
res.LoadFromStream(BinaryStream); | ||
result := res.Text; | ||
end; | ||
finally | ||
BinaryStream.Free; | ||
res.Free; | ||
end; | ||
end; | ||
|
||
function GetChromeCacheRawData(const HTML: string): string; | ||
var | ||
slp: TStringLoop; | ||
foundheader, foundcontent: boolean; | ||
hline, resstr: string; | ||
begin | ||
foundcontent := false; | ||
foundheader := false; | ||
slp := TStringLoop.Create; | ||
slp.LoadFromString(HTML); | ||
while slp.Found do | ||
begin | ||
if beginswith(slp.current, cHexPos) then | ||
begin | ||
if foundheader = true then | ||
foundcontent := true; // starts with second occurrence | ||
foundheader := true; | ||
end; | ||
if foundcontent then | ||
begin | ||
hline := slp.current; | ||
if resstr = emptystr then | ||
resstr := hline | ||
else | ||
resstr := resstr + crlf + hline; | ||
end; | ||
end; | ||
result := resstr; | ||
slp.Free; | ||
end; | ||
|
||
function ChromeCacheToHexStr(HTML: string): string; | ||
var | ||
slp: TStringLoop; | ||
foundheader, foundcontent: boolean; | ||
hline, resstr: string; | ||
begin | ||
foundcontent := false; | ||
foundheader := false; | ||
slp := TStringLoop.Create; | ||
slp.LoadFromString(HTML); | ||
while slp.Found do | ||
begin | ||
if beginswith(slp.current, cHexPos) then | ||
begin | ||
if foundheader = true then | ||
foundcontent := true; // starts with second occurrence | ||
foundheader := true; | ||
end; | ||
if foundcontent then | ||
begin | ||
hline := slp.current; | ||
hline := after(hline, ':'); | ||
hline := trim(hline); | ||
hline := copy(hline, 1, 47); // previous CEF lib was col 62 | ||
hline := replacestr(hline, ' ', emptystr); | ||
resstr := resstr + hline; | ||
end; | ||
end; | ||
resstr := replacestr(resstr, crlf, emptystr); | ||
result := resstr; | ||
slp.Free; | ||
end; | ||
|
||
function IsContentGzipped(const HTML: string): boolean; | ||
begin | ||
result := false; | ||
if trim(getfield('Content-Encoding', HTML)) = 'gzip' then | ||
result := true; | ||
end; | ||
|
||
function GetChromeCacheResponseHeaders(const HTML: string): string; | ||
var | ||
slp: TStringLoop; | ||
hdr: string; | ||
isheader: boolean; | ||
begin | ||
hdr := emptystr; | ||
isheader := false; | ||
slp := TStringLoop.Create; | ||
slp.LoadFromString(HTML); | ||
while slp.Found do | ||
begin | ||
if beginswith(slp.current, 'HTTP/') then | ||
isheader := true; | ||
if beginswith(slp.current, cHexPos) then | ||
begin | ||
slp.Stop; | ||
end | ||
else | ||
begin | ||
if isheader then | ||
begin | ||
if hdr = emptystr then | ||
hdr := slp.current | ||
else | ||
hdr := hdr + crlf + slp.current; | ||
end; | ||
end; | ||
end; | ||
slp.Free; | ||
result := hdr; | ||
end; | ||
|
||
function ChromeCacheToString(const HTML: string): string; | ||
var | ||
h: string; | ||
begin | ||
h := ChromeCacheToHexStr(HTML); | ||
if IsContentGzipped(HTML) = false then | ||
result := hextostr(h) | ||
else | ||
result := GUnzipHexStr(h); | ||
end; | ||
|
||
procedure ChromeCacheExtract(const HTML, OutFilename: string); | ||
begin | ||
SaveHexStringToFile(ChromeCacheToHexStr(HTML), OutFilename, | ||
IsContentGzipped(HTML)); | ||
end; | ||
|
||
end. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
unit CatCLUtils; | ||
{ | ||
Catarinka - Command-line parameters related functions | ||
Copyright (c) 2003-2014 Felipe Daragon | ||
License: 3-clause BSD | ||
See https://github.com/felipedaragon/catarinka/ for details | ||
} | ||
|
||
interface | ||
|
||
uses | ||
{$IF CompilerVersion >= 23} // XE2 or higher | ||
System.SysUtils; | ||
{$ELSE} | ||
SysUtils; | ||
{$IFEND} | ||
function GetCmdLine: string; | ||
function GetCmdParam(const param: string; const def_value: string = ''): string; | ||
function GetCmdParamQuoted(const param: string; | ||
const def_value: string = ''): string; | ||
function HasCmdParam(const param: string): boolean; | ||
|
||
implementation | ||
|
||
uses | ||
CatStrings; | ||
|
||
function GetCmdLine: string; | ||
var | ||
i: integer; | ||
begin | ||
result := emptystr; | ||
if ParamCount > 0 then | ||
for i := 1 to ParamCount do | ||
result := result + ' ' + (ParamStr(i)); | ||
end; | ||
|
||
// eg: if hascmdparam('-test') then ... | ||
function HasCmdParam(const param: string): boolean; | ||
var | ||
i: integer; | ||
begin | ||
result := false; | ||
if ParamCount = 0 then | ||
exit; | ||
for i := 1 to ParamCount do | ||
begin | ||
if lowercase(ParamStr(i)) = lowercase(param) then | ||
result := true; | ||
end; | ||
end; | ||
|
||
// if paramstr is: name:somestring | ||
// eg: getCmdParam('name') will return "somestring" | ||
function GetCmdParam(const param: string; const def_value: string = ''): string; | ||
var | ||
i: integer; | ||
params: string; | ||
begin | ||
result := emptystr; | ||
if ParamCount = 0 then | ||
exit; | ||
for i := 1 to ParamCount do | ||
params := params + ' ' + (ParamStr(i)); | ||
params := params + ' '; | ||
result := after(params, param + ':'); | ||
|
||
result := before(result, ' '); | ||
if result = emptystr then | ||
result := def_value; | ||
end; | ||
|
||
function GetCmdParamQuoted(const param: string; | ||
const def_value: string = ''): string; | ||
var | ||
i: integer; | ||
params: string; | ||
const | ||
quote = '"'; | ||
begin | ||
result := emptystr; | ||
if ParamCount = 0 then | ||
exit; | ||
for i := 1 to ParamCount do | ||
params := params + ' ' + (ParamStr(i)); | ||
params := params + ' '; | ||
result := after(params, param + ':'); | ||
|
||
if beginswith(result, quote) then | ||
begin | ||
result := after(result, quote); | ||
result := before(result, quote); | ||
end | ||
else | ||
result := before(result, ' '); | ||
if result = emptystr then | ||
result := def_value; | ||
end; | ||
|
||
// ------------------------------------------------------------------------// | ||
end. |
Oops, something went wrong.