Skip to content

Commit 90169ec

Browse files
committed
init
0 parents  commit 90169ec

File tree

77 files changed

+3697
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+3697
-0
lines changed

.github/workflows/ci.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
stages:
2+
- lint
3+
- test
4+
- build
5+
- deploy
6+
7+
variables:
8+
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.pip-cache"
9+
10+
cache:
11+
paths:
12+
- .pip-cache/
13+
14+
lint:
15+
stage: lint
16+
image: python:3.9
17+
before_script:
18+
- pip install flake8
19+
script:
20+
- flake8 .
21+
22+
test:
23+
stage: test
24+
image: python:3.9
25+
before_script:
26+
- pip install -r requirements.txt
27+
- pip install pytest pytest-cov
28+
script:
29+
- pytest tests/ --cov=./ --cov-report=xml
30+
artifacts:
31+
reports:
32+
coverage_report:
33+
coverage_format: cobertura
34+
path: coverage.xml
35+
36+
build:
37+
stage: build
38+
image: python:3.9
39+
script:
40+
- pip install pyinstaller
41+
- pyinstaller --onefile main.py
42+
artifacts:
43+
paths:
44+
- dist/main
45+
46+
deploy:
47+
stage: deploy
48+
image: python:3.9
49+
script:
50+
- echo "Deploying application..."
51+
# Add your deployment steps here
52+
only:
53+
- main # This job will only run on the main branch

.idea/.gitignore

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/AbapCodeScannerFramework.iml

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/inspectionProfiles/Project_Default.xml

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/inspectionProfiles/profiles_settings.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

checks/CheckAbapOutgoingFtpConn.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# checks/check_abap_outgoing_ftp_conn.py
2+
3+
import re
4+
from dataclasses import dataclass
5+
from typing import List
6+
7+
@dataclass
8+
class CheckResult:
9+
line_number: int
10+
line_content: str
11+
12+
class CheckAbapOutgoingFtpConn:
13+
title = "Outgoing FTP Connection"
14+
severity = "Low"
15+
vulnerability_type = "Unencrypted Communications"
16+
17+
def __init__(self):
18+
self.pattern = re.compile(
19+
r"(\bCALL FUNCTION\b)(\s*'FTP_CONNECT'.+?\.)",
20+
re.DOTALL | re.IGNORECASE
21+
)
22+
23+
def run(self, file_content: str) -> List[CheckResult]:
24+
match = self.pattern.search(file_content)
25+
if match:
26+
line_number = file_content[:match.start()].count('\n') + 1
27+
return [CheckResult(line_number, match.group().strip())]
28+
return []
29+

checks/CheckBrokenAuthCheck.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# checks/check_broken_auth_check.py
2+
3+
import re
4+
from dataclasses import dataclass
5+
from typing import List
6+
7+
8+
@dataclass
9+
class CheckResult:
10+
line_number: int
11+
line_content: str
12+
13+
14+
class CheckBrokenAuthCheck:
15+
title = "Broken AUTH Checks"
16+
severity = "Medium"
17+
vulnerability_type = "Access Control Bypass"
18+
19+
def __init__(self):
20+
self.main_pattern = re.compile(
21+
r"(?ims)^[\s]*(\bAUTHORITY-CHECK\b\s*OBJECT.+?\.)\s*(\s*IF\s*sy(st)?-subrc)?",
22+
re.DOTALL | re.IGNORECASE
23+
)
24+
25+
def check_second_stage(self, match: re.Match) -> bool:
26+
if_subrc_pattern = re.compile(r"(?ims)^[\s]*IF\s*sy(st)?-subrc", re.IGNORECASE)
27+
return not if_subrc_pattern.search(match.group())
28+
29+
def run(self, file_content: str) -> List[CheckResult]:
30+
results = []
31+
for match in self.main_pattern.finditer(file_content):
32+
if self.check_second_stage(match):
33+
line_number = file_content[:match.start()].count('\n') + 1
34+
results.append(CheckResult(line_number, match.group().strip()))
35+
return results

0 commit comments

Comments
 (0)