Skip to content

Commit

Permalink
Merge pull request #9 from Kuucheen/dev
Browse files Browse the repository at this point in the history
Dev merge
  • Loading branch information
Kuucheen committed Jan 6, 2024
2 parents 712e6b8 + c6b57e8 commit 399c573
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 22 deletions.
27 changes: 27 additions & 0 deletions build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
@echo off

set OUTPUT_FOLDER=bin
set BINARY_NAME=KC-Checker

echo Compiling for Windows...
set GOOS=windows
set GOARCH=amd64
go build -o %OUTPUT_FOLDER%\%BINARY_NAME%.exe
if %ERRORLEVEL% neq 0 (
echo Compilation failed for Windows
exit /b %ERRORLEVEL%
)
echo Compilation for Windows successful

echo Compiling for Linux...
set GOOS=linux
set GOARCH=amd64
go build -o %OUTPUT_FOLDER%\%BINARY_NAME%
if %ERRORLEVEL% neq 0 (
echo Compilation failed for Linux
exit /b %ERRORLEVEL%
)
echo Compilation for Linux successful

echo Compilation completed successfully for both Windows and Linux
exit /b 0
7 changes: 0 additions & 7 deletions charm/threadPhase/displayer.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
package threadPhase

// A simple example that shows how to render an animated elite bar. In this
// example we bump the elite by 25% every two seconds, animating our
// elite bar to its new target state.
//
// It's also possible to render a elite bar in a more static fashion without
// transitions. For details on that approach see the elite-static example.

import (
"KC-Checker/common"
"KC-Checker/helper"
Expand Down
2 changes: 1 addition & 1 deletion charm/threadPhase/styler.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func getStyledInfo(elite int, anon int, trans int) string {
BorderStyle(lipgloss.NormalBorder()).
BorderBottom(true).
Align(lipgloss.Center).
PaddingRight(5).
PaddingRight(6).
Width(GetWidth() / 4).
Render(retString)
}
Expand Down
14 changes: 7 additions & 7 deletions helper/CheckerHelper.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,22 @@ import (
"time"
)

func GetProxyLevel(innerhtml string) int {
if strings.Contains(innerhtml, common.UserIP) {
func GetProxyLevel(html string) int {
//When the headers contain UserIp proxy is transparent
if strings.Contains(html, common.UserIP) {
return 1
}

//When containing one of these headers proxy is anonymous
proxyVars := []string{"HTTP_X_FORWARDED_FOR", "HTTP_FORWARDED", "HTTP_VIA", "HTTP_X_PROXY_ID"}

for _, value := range proxyVars {
if strings.Contains(innerhtml, value) {
if strings.Contains(html, value) {
return 2
}
}

//Proxy is elite
return 3

}
Expand Down Expand Up @@ -73,12 +76,9 @@ func RequestCustom(proxy *Proxy, siteUrl string) (string, int) {

resp, err := client.Do(req)
if err != nil {
if strings.Contains(err.Error(), "Maximum number of open connections reached.") {
return "Maximum number of open connections reached", -1
}

return "Error making HTTP request", -1
}

defer func() {
if r := recover(); r != nil {
}
Expand Down
4 changes: 2 additions & 2 deletions helper/FileHelper.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import (

var ProxySum float64

func Write(proxies map[int][]*Proxy, style int, bancheck bool) string {
func Write(proxies map[int][]*Proxy, style int, banCheck bool) string {
pType := GetTypeName()

for _, proxyLevel := range proxies {
filtered := ""

if bancheck {
if banCheck {
filtered = "BanChecked/"
}

Expand Down
1 change: 1 addition & 0 deletions helper/proxyQueue.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package helper

// ProxyQueue This is for displaying the latest proxies in the threadPhase
type ProxyQueue struct {
data []*Proxy
}
Expand Down
11 changes: 6 additions & 5 deletions helper/threadHelper.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,28 +58,29 @@ func check(proxy *Proxy) {
level = GetProxyLevel(body)
levels := []int{1, 2, 3}

mutex.Lock()

if isInList(level, levels) {
mutex.Lock()

proxy.Level = level
ProxyMap[level] = append(ProxyMap[level], proxy)
ProxyCountMap[level]++
proxyQueue.Enqueue(proxy)

mutex.Unlock()
} else {
atomic.AddInt32(&Invalid, 1)
}

mutex.Unlock()

responded = true
break
}

//Ban check for websites
if responded && common.DoBanCheck() {
for i := 0; i < retries; i++ {
body, status := RequestCustom(proxy, common.GetConfig().Bancheck)

if status >= 400 || status == -1 {
if !(status >= 400) && status != -1 {
keywords := common.GetConfig().Keywords

if len(keywords) == 0 || len(keywords[0]) == 0 || ContainsSlice(keywords, body) {
Expand Down

0 comments on commit 399c573

Please sign in to comment.