|
| 1 | +<!DOCTYPE html> |
| 2 | +<html class="writer-html5" lang="en" > |
| 3 | +<head> |
| 4 | + <meta charset="utf-8" /> |
| 5 | + <meta http-equiv="X-UA-Compatible" content="IE=edge" /> |
| 6 | + <meta name="viewport" content="width=device-width, initial-scale=1.0" /><link rel="canonical" href="https://www.gitxray.com/code_structure/" /> |
| 7 | + <link rel="shortcut icon" href="../img/favicon.ico" /> |
| 8 | + <title>Code structure - Gitxray</title> |
| 9 | + <link rel="stylesheet" href="../css/theme.css" /> |
| 10 | + <link rel="stylesheet" href="../css/theme_extra.css" /> |
| 11 | + <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/styles/github.min.css" /> |
| 12 | + |
| 13 | + <script> |
| 14 | + // Current page data |
| 15 | + var mkdocs_page_name = "Code structure"; |
| 16 | + var mkdocs_page_input_path = "code_structure.md"; |
| 17 | + var mkdocs_page_url = "/code_structure/"; |
| 18 | + </script> |
| 19 | + |
| 20 | + <!--[if lt IE 9]> |
| 21 | + <script src="../js/html5shiv.min.js"></script> |
| 22 | + <![endif]--> |
| 23 | + <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/highlight.min.js"></script> |
| 24 | + <script>hljs.highlightAll();</script> |
| 25 | +</head> |
| 26 | + |
| 27 | +<body class="wy-body-for-nav" role="document"> |
| 28 | + |
| 29 | + <div class="wy-grid-for-nav"> |
| 30 | + <nav data-toggle="wy-nav-shift" class="wy-nav-side stickynav"> |
| 31 | + <div class="wy-side-scroll"> |
| 32 | + <div class="wy-side-nav-search"> |
| 33 | + <a href=".." class="icon icon-home"> Gitxray |
| 34 | + </a><div role="search"> |
| 35 | + <form id ="rtd-search-form" class="wy-form" action="../search.html" method="get"> |
| 36 | + <input type="text" name="q" placeholder="Search docs" aria-label="Search docs" title="Type search term here" /> |
| 37 | + </form> |
| 38 | +</div> |
| 39 | + </div> |
| 40 | + |
| 41 | + <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu"> |
| 42 | + <ul> |
| 43 | + <li class="toctree-l1"><a class="reference internal" href="../installing/">Installing and Updating Gitxray</a> |
| 44 | + </li> |
| 45 | + </ul> |
| 46 | + <ul> |
| 47 | + <li class="toctree-l1"><a class="reference internal" href="../features/">Features 💫</a> |
| 48 | + </li> |
| 49 | + </ul> |
| 50 | + <ul> |
| 51 | + <li class="toctree-l1"><a class="reference internal" href="../vulnerable_workflows/">Vulnerable Workflows</a> |
| 52 | + </li> |
| 53 | + </ul> |
| 54 | + <ul class="current"> |
| 55 | + <li class="toctree-l1 current"><a class="reference internal current" href="#">Code structure</a> |
| 56 | + <ul class="current"> |
| 57 | + </ul> |
| 58 | + </li> |
| 59 | + </ul> |
| 60 | + <ul> |
| 61 | + <li class="toctree-l1"><a class="reference internal" href="../gitxray_buzz/">Gitxray Buzz</a> |
| 62 | + </li> |
| 63 | + </ul> |
| 64 | + </div> |
| 65 | + </div> |
| 66 | + </nav> |
| 67 | + |
| 68 | + <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> |
| 69 | + <nav class="wy-nav-top" role="navigation" aria-label="Mobile navigation menu"> |
| 70 | + <i data-toggle="wy-nav-top" class="fa fa-bars"></i> |
| 71 | + <a href="..">Gitxray</a> |
| 72 | + |
| 73 | + </nav> |
| 74 | + <div class="wy-nav-content"> |
| 75 | + <div class="rst-content"><div role="navigation" aria-label="breadcrumbs navigation"> |
| 76 | + <ul class="wy-breadcrumbs"> |
| 77 | + <li><a href=".." class="icon icon-home" aria-label="Docs"></a></li> |
| 78 | + <li class="breadcrumb-item active">Code structure</li> |
| 79 | + <li class="wy-breadcrumbs-aside"> |
| 80 | + <a href="https://github.com/kulkansecurity/gitxray/edit/master/docs/code_structure.md" class="icon icon-github"> Edit on GitHub</a> |
| 81 | + </li> |
| 82 | + </ul> |
| 83 | + <hr/> |
| 84 | +</div> |
| 85 | + <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> |
| 86 | + <div class="section" itemprop="articleBody"> |
| 87 | + |
| 88 | + <h1 id="code-structure">Code structure<a class="headerlink" href="#code-structure" title="Permanent link"></a></h1> |
| 89 | +<p>A few pointers on how the Gitxray codebase is structured:</p> |
| 90 | +<ul> |
| 91 | +<li><code>gitxray.py</code> - The main script, creates a gx_context, gx_output and calls X-Ray modules.</li> |
| 92 | +</ul> |
| 93 | +<p>The include directory has files split in two naming conventions:</p> |
| 94 | +<ul> |
| 95 | +<li>Suffix: <code>gh_</code> - Files that handle GitHub API responses or talk to the GitHub API</li> |
| 96 | +<li>Suffix: <code>gx_</code> - Files with more Gitxray-specific logic</li> |
| 97 | +</ul> |
| 98 | +<p>Some of the supporting files in the include directory:</p> |
| 99 | +<ul> |
| 100 | +<li><code>gx_context.py</code> - Holds a context of data that is shared across different X-Ray modules and through out execution.</li> |
| 101 | +<li><code>gx_output.py</code> - Takes care of any console printing, as well as text and json output.</li> |
| 102 | +</ul> |
| 103 | +<p>For parsing SSH and PGP signatures, we wrote our own code and placed it in:</p> |
| 104 | +<ul> |
| 105 | +<li><code>gx_ugly_openpgp_parser.py</code> - Parses Armors and BLOBs based on RFC4880</li> |
| 106 | +<li><code>gx_ugly_ssh_parser.py</code> - Parses (if you can call that Parsing) SSH Armors and BLOBs</li> |
| 107 | +</ul> |
| 108 | +<p>Finally, last but not least important, the X-Rays under the xrays directory:</p> |
| 109 | +<ul> |
| 110 | +<li><code>contributors_xray.py</code> - Handles all Contributor-related data and decides what to log.</li> |
| 111 | +<li><code>repository_xray.py</code> - Handles all Repository-related data and decides what to log.</li> |
| 112 | +<li><code>workflows_xray.py</code> - Handles all Workflow-related analysis and decides what to log.</li> |
| 113 | +<li><code>associations_xray.py</code> - Analyzes and reports all associations carried from prior X-Ray modules.</li> |
| 114 | +</ul> |
| 115 | + |
| 116 | + </div> |
| 117 | + </div><footer> |
| 118 | + <div class="rst-footer-buttons" role="navigation" aria-label="Footer Navigation"> |
| 119 | + <a href="../vulnerable_workflows/" class="btn btn-neutral float-left" title="Vulnerable Workflows"><span class="icon icon-circle-arrow-left"></span> Previous</a> |
| 120 | + <a href="../gitxray_buzz/" class="btn btn-neutral float-right" title="Gitxray Buzz">Next <span class="icon icon-circle-arrow-right"></span></a> |
| 121 | + </div> |
| 122 | + |
| 123 | + <hr/> |
| 124 | + |
| 125 | + <div role="contentinfo"> |
| 126 | + <!-- Copyright etc --> |
| 127 | + <p>Made with ♥ by <a href="https://www.kulkan.com" target="_blank">Kulkan Security</a> - your favorite <a href="https://www.kulkan.com" target="_blank">Penetration Testing Partner</a>. |
| 128 | +</p> |
| 129 | + </div> |
| 130 | + |
| 131 | + Built with <a href="https://www.mkdocs.org/">MkDocs</a> using a <a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. |
| 132 | +</footer> |
| 133 | + |
| 134 | + </div> |
| 135 | + </div> |
| 136 | + |
| 137 | + </section> |
| 138 | + |
| 139 | + </div> |
| 140 | + |
| 141 | + <div class="rst-versions" role="note" aria-label="Versions"> |
| 142 | + <span class="rst-current-version" data-toggle="rst-current-version"> |
| 143 | + |
| 144 | + <span> |
| 145 | + <a href="https://github.com/kulkansecurity/gitxray" class="fa fa-github" style="color: #fcfcfc"> GitHub</a> |
| 146 | + </span> |
| 147 | + |
| 148 | + |
| 149 | + <span><a href="../vulnerable_workflows/" style="color: #fcfcfc">« Previous</a></span> |
| 150 | + |
| 151 | + |
| 152 | + <span><a href="../gitxray_buzz/" style="color: #fcfcfc">Next »</a></span> |
| 153 | + |
| 154 | + </span> |
| 155 | +</div> |
| 156 | + <script src="../js/jquery-3.6.0.min.js"></script> |
| 157 | + <script>var base_url = "..";</script> |
| 158 | + <script src="../js/theme_extra.js"></script> |
| 159 | + <script src="../js/theme.js"></script> |
| 160 | + <script src="../search/main.js"></script> |
| 161 | + <script> |
| 162 | + jQuery(function () { |
| 163 | + SphinxRtdTheme.Navigation.enable(true); |
| 164 | + }); |
| 165 | + </script> |
| 166 | + |
| 167 | +</body> |
| 168 | +</html> |
0 commit comments