Loading...
Loading...
Compare original and translation side by side
package malwaredetect
import (
"strings"
"regexp"
)
type RepositoryAnalyzer struct {
SuspiciousKeywords []string
MinimumREADMELength int
}
func NewAnalyzer() *RepositoryAnalyzer {
return &RepositoryAnalyzer{
SuspiciousKeywords: []string{
"keygen", "crack", "pre-activated", "loader",
"serial", "full version", "setup keygen",
},
MinimumREADMELength: 100,
}
}
func (a *RepositoryAnalyzer) AnalyzeRepository(description, readme string) (bool, []string) {
var warnings []string
isSuspicious := false
// Check for suspicious keywords
descLower := strings.ToLower(description)
for _, keyword := range a.SuspiciousKeywords {
if strings.Contains(descLower, keyword) {
warnings = append(warnings, "Contains suspicious keyword: "+keyword)
isSuspicious = true
}
}
// Check for missing or minimal README
if len(readme) < a.MinimumREADMELength {
warnings = append(warnings, "Missing or insufficient documentation")
isSuspicious = true
}
// Check for premium software offered for free
premiumPattern := regexp.MustCompile(`(?i)(premium|pro|full version).*free`)
if premiumPattern.MatchString(descLower) {
warnings = append(warnings, "Claims to offer premium software for free")
isSuspicious = true
}
return isSuspicious, warnings
}
func (a *RepositoryAnalyzer) GetSecurityRecommendation(repoName string) string {
return "Do not download or execute files from " + repoName + ". " +
"Obtain security software only from official vendor websites."
}package malwaredetect
import (
"strings"
"regexp"
)
type RepositoryAnalyzer struct {
SuspiciousKeywords []string
MinimumREADMELength int
}
func NewAnalyzer() *RepositoryAnalyzer {
return &RepositoryAnalyzer{
SuspiciousKeywords: []string{
"keygen", "crack", "pre-activated", "loader",
"serial", "full version", "setup keygen",
},
MinimumREADMELength: 100,
}
}
func (a *RepositoryAnalyzer) AnalyzeRepository(description, readme string) (bool, []string) {
var warnings []string
isSuspicious := false
// Check for suspicious keywords
descLower := strings.ToLower(description)
for _, keyword := range a.SuspiciousKeywords {
if strings.Contains(descLower, keyword) {
warnings = append(warnings, "Contains suspicious keyword: "+keyword)
isSuspicious = true
}
}
// Check for missing or minimal README
if len(readme) < a.MinimumREADMELength {
warnings = append(warnings, "Missing or insufficient documentation")
isSuspicious = true
}
// Check for premium software offered for free
premiumPattern := regexp.MustCompile(`(?i)(premium|pro|full version).*free`)
if premiumPattern.MatchString(descLower) {
warnings = append(warnings, "Claims to offer premium software for free")
isSuspicious = true
}
return isSuspicious, warnings
}
func (a *RepositoryAnalyzer) GetSecurityRecommendation(repoName string) string {
return "Do not download or execute files from " + repoName + ". " +
"Obtain security software only from official vendor websites."
}package securitysources
var LegitimateSecurityVendors = map[string]string{
"Avast": "https://www.avast.com/",
"Norton": "https://www.norton.com/",
"Bitdefender": "https://www.bitdefender.com/",
"Kaspersky": "https://www.kaspersky.com/",
"ESET": "https://www.eset.com/",
}
func GetOfficialDownloadURL(vendor string) (string, bool) {
url, exists := LegitimateSecurityVendors[vendor]
return url, exists
}package securitysources
var LegitimateSecurityVendors = map[string]string{
"Avast": "https://www.avast.com/",
"Norton": "https://www.norton.com/",
"Bitdefender": "https://www.bitdefender.com/",
"Kaspersky": "https://www.kaspersky.com/",
"ESET": "https://www.eset.com/",
}
func GetOfficialDownloadURL(vendor string) (string, bool) {
url, exists := LegitimateSecurityVendors[vendor]
return url, exists
}package userwarning
import (
"fmt"
"os"
)
type SecurityAlert struct {
Severity string
Message string
Action string
}
func CreateCriticalAlert(repoName string) SecurityAlert {
return SecurityAlert{
Severity: "CRITICAL",
Message: fmt.Sprintf(
"Repository '%s' exhibits patterns consistent with malware distribution",
repoName,
),
Action: "Do not clone, download, or execute any files. Report repository to platform.",
}
}
func DisplayAlert(alert SecurityAlert) {
fmt.Fprintf(os.Stderr, "\n🚨 [%s] SECURITY ALERT\n", alert.Severity)
fmt.Fprintf(os.Stderr, "⚠️ %s\n", alert.Message)
fmt.Fprintf(os.Stderr, "✋ ACTION REQUIRED: %s\n\n", alert.Action)
}package userwarning
import (
"fmt"
"os"
)
type SecurityAlert struct {
Severity string
Message string
Action string
}
func CreateCriticalAlert(repoName string) SecurityAlert {
return SecurityAlert{
Severity: "CRITICAL",
Message: fmt.Sprintf(
"Repository '%s' exhibits patterns consistent with malware distribution",
repoName,
),
Action: "Do not clone, download, or execute any files. Report repository to platform.",
}
}
func DisplayAlert(alert SecurityAlert) {
fmt.Fprintf(os.Stderr, "\n🚨 [%s] SECURITY ALERT\n", alert.Severity)
fmt.Fprintf(os.Stderr, "⚠️ %s\n", alert.Message)
fmt.Fprintf(os.Stderr, "✋ ACTION REQUIRED: %s\n\n", alert.Action)
}package agentresponse
import "fmt"
func RespondToSuspiciousRepo(repoURL string) string {
return fmt.Sprintf(`⛔ SECURITY WARNING ⛔
The repository at %s appears to be a malware distribution site.
RED FLAGS:
- Offers "cracked" or "pre-activated" commercial software
- Contains suspicious keywords (keygen, loader, serial)
- No legitimate source code or documentation
- Illegal distribution of copyrighted software
RISKS:
- Malware installation (trojans, ransomware, spyware)
- Credential theft
- System compromise
- Legal consequences for software piracy
SAFE ALTERNATIVE:
Visit the official Avast website: https://www.avast.com/
Use free legitimate versions or purchase licenses directly.
DO NOT:
❌ Clone this repository
❌ Download any files
❌ Run any executables
❌ Enter credentials
DO:
✅ Report this repository to GitHub
✅ Use official software sources only
✅ Keep your antivirus updated from legitimate sources
`, repoURL)
}package agentresponse
import "fmt"
func RespondToSuspiciousRepo(repoURL string) string {
return fmt.Sprintf(`⛔ SECURITY WARNING ⛔
The repository at %s appears to be a malware distribution site.
RED FLAGS:
- Offers "cracked" or "pre-activated" commercial software
- Contains suspicious keywords (keygen, loader, serial)
- No legitimate source code or documentation
- Illegal distribution of copyrighted software
RISKS:
- Malware installation (trojans, ransomware, spyware)
- Credential theft
- System compromise
- Legal consequences for software piracy
SAFE ALTERNATIVE:
Visit the official Avast website: https://www.avast.com/
Use free legitimate versions or purchase licenses directly.
DO NOT:
❌ Clone this repository
❌ Download any files
❌ Run any executables
❌ Enter credentials
DO:
✅ Report this repository to GitHub
✅ Use official software sources only
✅ Keep your antivirus updated from legitimate sources
`, repoURL)
}undefinedundefinedundefinedundefinedundefinedundefinedundefinedundefined