mirror of
https://github.com/anotherhadi/github-recon.git
synced 2026-10-05 10:58:25 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2d01c1639f | ||
|
|
66030c1c16 | ||
|
|
bb8f34055d | ||
|
|
26a1cfdd37 |
@@ -98,7 +98,7 @@ nix run github:anotherhadi/github-recon -- [--flags value] target_username_or_em
|
|||||||
|
|
||||||
# then add it to your packages
|
# then add it to your packages
|
||||||
environment.systemPackages = with pkgs; [ # or home.packages
|
environment.systemPackages = with pkgs; [ # or home.packages
|
||||||
github-recon
|
inputs.github-recon.defaultPackage.${pkgs.system}
|
||||||
];
|
];
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,11 @@ import (
|
|||||||
type CloseFriendsResult []CloseFriendResult
|
type CloseFriendsResult []CloseFriendResult
|
||||||
|
|
||||||
type CloseFriendResult struct {
|
type CloseFriendResult struct {
|
||||||
|
Name string
|
||||||
Username string
|
Username string
|
||||||
|
Orgs []string
|
||||||
|
Company string
|
||||||
|
Location string
|
||||||
Score int
|
Score int
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,8 +100,12 @@ func CloseFriends(s github_recon_settings.Settings) (results CloseFriendsResult)
|
|||||||
// Add candidate if they matched at least one condition
|
// Add candidate if they matched at least one condition
|
||||||
if score > 0 {
|
if score > 0 {
|
||||||
results = append(results, CloseFriendResult{
|
results = append(results, CloseFriendResult{
|
||||||
|
Name: candidateDetails.GetName(),
|
||||||
Username: candidateLogin,
|
Username: candidateLogin,
|
||||||
|
Orgs: candidateOrgsToNames(candidateOrgs),
|
||||||
Score: score,
|
Score: score,
|
||||||
|
Location: candidateDetails.GetLocation(),
|
||||||
|
Company: candidateDetails.GetCompany(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -130,6 +138,15 @@ func checkIfUserFollows(s github_recon_settings.Settings, sourceUser, targetUser
|
|||||||
}
|
}
|
||||||
return isFollowing, nil
|
return isFollowing, nil
|
||||||
}
|
}
|
||||||
|
func candidateOrgsToNames(orgs []*github.Organization) []string {
|
||||||
|
var orgNames []string
|
||||||
|
for _, org := range orgs {
|
||||||
|
if org.GetLogin() != "" {
|
||||||
|
orgNames = append(orgNames, org.GetLogin())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return orgNames
|
||||||
|
}
|
||||||
|
|
||||||
func getOrgs(s github_recon_settings.Settings, user string) ([]*github.Organization, error) {
|
func getOrgs(s github_recon_settings.Settings, user string) ([]*github.Organization, error) {
|
||||||
orgs, resp, err := s.Client.Organizations.List(s.Ctx, user, nil)
|
orgs, resp, err := s.Client.Organizations.List(s.Ctx, user, nil)
|
||||||
|
|||||||
@@ -334,13 +334,13 @@ func findEmailsAndOccurrencesInDir(rootPath string, username string) (Emails, er
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if !d.IsDir() {
|
if d.Type().IsRegular() {
|
||||||
if strings.Contains(path, ".git/logs/") {
|
if strings.Contains(path, ".git/logs/") {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
content, err := os.ReadFile(path)
|
content, err := os.ReadFile(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
currentFileEmails := emailRegex.FindAllString(string(content), -1)
|
currentFileEmails := emailRegex.FindAllString(string(content), -1)
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ func GetSettings() (settings Settings) {
|
|||||||
|
|
||||||
// If token is not set via flag, get it from env
|
// If token is not set via flag, get it from env
|
||||||
if settings.Token == "null" || settings.Token == "" {
|
if settings.Token == "null" || settings.Token == "" {
|
||||||
settings.Token = getToken()
|
settings.Token = GetToken()
|
||||||
}
|
}
|
||||||
|
|
||||||
if settings.Token == "null" || settings.Token == "" {
|
if settings.Token == "null" || settings.Token == "" {
|
||||||
|
|||||||
+2
-1
@@ -9,7 +9,8 @@ import (
|
|||||||
flag "github.com/spf13/pflag"
|
flag "github.com/spf13/pflag"
|
||||||
)
|
)
|
||||||
|
|
||||||
func getToken() string {
|
// GetToken retrieves the GitHub token from the environment variable or config file
|
||||||
|
func GetToken() string {
|
||||||
token := os.Getenv("GITHUB_RECON_TOKEN")
|
token := os.Getenv("GITHUB_RECON_TOKEN")
|
||||||
if token != "" {
|
if token != "" {
|
||||||
return token
|
return token
|
||||||
|
|||||||
Reference in New Issue
Block a user