mirror of
https://github.com/tenox7/wrp.git
synced 2026-02-12 13:46:03 +00:00
Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6784d47892 | ||
|
|
c96eb9ae35 | ||
|
|
cebebfa408 | ||
|
|
9d7bb952c5 | ||
|
|
fd4b7a381e | ||
|
|
b894c3f809 | ||
|
|
733efaea56 | ||
|
|
ad668d1bca | ||
|
|
4e28a50a8d | ||
|
|
2fab53d8a3 | ||
|
|
9557f172ed | ||
|
|
a3661003b0 | ||
|
0502f7a99d
|
|||
|
|
877c42a388 |
20
README.md
20
README.md
@@ -1,24 +1,24 @@
|
||||
# WRP - Web Rendering Proxy
|
||||
|
||||
A HTTP proxy server that allows to use historical and obsolete web browsers on the modern web. It works by rendering the web page in to a GIF image associated with clickable imagemap of original web links.
|
||||
A HTTP proxy server that allows to use historical and obsolete web browsers on the modern web. It works by rendering the web page in to a GIF image. It sends mouse clicks via ISMAP and keystrokes from a text box form input.
|
||||
|
||||
## Current Status
|
||||
|
||||
* This is the new GoLang/[ChdomeDP](https://github.com/chromedp/chromedp) version.
|
||||
* It's still lacking some features of the [older version](/old) but far surpasses it in terms of stability and usability.
|
||||
* It's beta quality but unlike the old version, it's now fully supported an maintained.
|
||||
* Currently works as browser-in-browser. A real http proxy mode is being investigated. Check [issue #35](https://github.com/tenox7/wrp/issues/35) for updates.
|
||||
* This is a new reimplementation in GoLang/[ChromeDP](https://github.com/chromedp/chromedp). Python/Webkit being now deprecated.
|
||||
* Beta but fully supported an maintained.
|
||||
* Works as browser-in-browser. A real http proxy mode is being investigated. Check [issue #35](https://github.com/tenox7/wrp/issues/35) for updates.
|
||||
* As of 4.1 supports clicking on non-link elements (eg. cookie warnings, dropdown menus, etc.) and sending keystrokes. Yes, you can login and use Gmail or play web based games from any old browser.
|
||||
|
||||
## Usage
|
||||
|
||||
1. [Download a WRP binary](https://github.com/tenox7/wrp/releases) and run it on a machine that will become your WRP server.
|
||||
1. [Download a WRP binary](https://github.com/tenox7/wrp/releases/) and run it on a machine that will become your WRP server.
|
||||
2. Point your legacy browser to `http://address:port` of WRP server. Do not set or use it as a "Proxy Server" (yet).
|
||||
3. Type a search string or a http/https URL and click Go.
|
||||
3. Type a search string or a http/https URL and click GO.
|
||||
4. Adjust your screen width/height/scale/#colors to fit in your old browser.
|
||||
5. For very very very old browsers such as Mosaic 2.x and IBM WebExplorer 1.x tick the I checkbox to enable ISMAP mode. However this normally should not be needed.
|
||||
6. Scroll web page by clicking Up/Down. To go to top enter 0 and click Go.
|
||||
5. Scroll web page by clicking on the in-image scroll bar.
|
||||
6. Send keystrokes by filling in K input box and pressing Go. You also have buttons for backspace, enter and arrow keys.
|
||||
|
||||

|
||||

|
||||
|
||||
## Flags
|
||||
```
|
||||
|
||||
61
wrp.go
61
wrp.go
@@ -23,14 +23,12 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/chromedp/cdproto/emulation"
|
||||
|
||||
"github.com/chromedp/chromedp"
|
||||
|
||||
"github.com/ericpauley/go-quantize/quantize"
|
||||
)
|
||||
|
||||
var (
|
||||
version = "4.0"
|
||||
version = "4.2"
|
||||
srv http.Server
|
||||
ctx context.Context
|
||||
cancel context.CancelFunc
|
||||
@@ -46,6 +44,8 @@ type wrpReq struct {
|
||||
C int64 // #colors
|
||||
X int64 // mouseX
|
||||
Y int64 // mouseY
|
||||
K string // keys to send
|
||||
F string // Fn buttons
|
||||
}
|
||||
|
||||
func (w *wrpReq) parseForm(req *http.Request) {
|
||||
@@ -70,6 +70,8 @@ func (w *wrpReq) parseForm(req *http.Request) {
|
||||
if w.C < 2 || w.C > 256 {
|
||||
w.C = 256
|
||||
}
|
||||
w.K = req.FormValue("k")
|
||||
w.F = req.FormValue("Fn")
|
||||
log.Printf("WrpReq from Form: %+v\n", w)
|
||||
}
|
||||
|
||||
@@ -77,12 +79,21 @@ func (w wrpReq) printPage(out http.ResponseWriter) {
|
||||
out.Header().Set("Content-Type", "text/html")
|
||||
fmt.Fprintf(out, "<!-- Web Rendering Proxy Version %s -->\n", version)
|
||||
fmt.Fprintf(out, "<HTML>\n<HEAD><TITLE>WRP %s</TITLE></HEAD>\n<BODY BGCOLOR=\"#F0F0F0\">\n", w.U)
|
||||
fmt.Fprintf(out, "<FORM ACTION=\"/\"><INPUT TYPE=\"TEXT\" NAME=\"url\" VALUE=\"%s\" SIZE=\"40\">", w.U)
|
||||
fmt.Fprintf(out, "<INPUT TYPE=\"SUBMIT\" VALUE=\"Go\"> \n")
|
||||
fmt.Fprintf(out, "<FORM ACTION=\"/\" METHOD=\"POST\">\n")
|
||||
fmt.Fprintf(out, "<INPUT TYPE=\"TEXT\" NAME=\"url\" VALUE=\"%s\" SIZE=\"10\">", w.U)
|
||||
fmt.Fprintf(out, "<INPUT TYPE=\"SUBMIT\" VALUE=\"Go\">\n")
|
||||
fmt.Fprintf(out, "<INPUT TYPE=\"SUBMIT\" NAME=\"Fn\" VALUE=\"Bk\">\n")
|
||||
fmt.Fprintf(out, "W <INPUT TYPE=\"TEXT\" NAME=\"w\" VALUE=\"%d\" SIZE=\"4\"> \n", w.W)
|
||||
fmt.Fprintf(out, "H <INPUT TYPE=\"TEXT\" NAME=\"h\" VALUE=\"%d\" SIZE=\"4\"> \n", w.H)
|
||||
fmt.Fprintf(out, "S <INPUT TYPE=\"TEXT\" NAME=\"s\" VALUE=\"%1.2f\" SIZE=\"3\"> \n", w.S)
|
||||
fmt.Fprintf(out, "C <INPUT TYPE=\"TEXT\" NAME=\"c\" VALUE=\"%d\" SIZE=\"3\"> \n", w.C)
|
||||
fmt.Fprintf(out, "C <INPUT TYPE=\"TEXT\" NAME=\"c\" VALUE=\"%d\" SIZE=\"3\">\n", w.C)
|
||||
fmt.Fprintf(out, "K <INPUT TYPE=\"TEXT\" NAME=\"k\" VALUE=\"\" SIZE=\"4\"> \n")
|
||||
fmt.Fprintf(out, "<INPUT TYPE=\"SUBMIT\" NAME=\"Fn\" VALUE=\"Bs\">\n")
|
||||
fmt.Fprintf(out, "<INPUT TYPE=\"SUBMIT\" NAME=\"Fn\" VALUE=\"Rt\">\n")
|
||||
fmt.Fprintf(out, "<INPUT TYPE=\"SUBMIT\" NAME=\"Fn\" VALUE=\"<\">\n")
|
||||
fmt.Fprintf(out, "<INPUT TYPE=\"SUBMIT\" NAME=\"Fn\" VALUE=\"^\">\n")
|
||||
fmt.Fprintf(out, "<INPUT TYPE=\"SUBMIT\" NAME=\"Fn\" VALUE=\"v\">\n")
|
||||
fmt.Fprintf(out, "<INPUT TYPE=\"SUBMIT\" NAME=\"Fn\" VALUE=\">\" SIZE=\"1\">\n")
|
||||
fmt.Fprintf(out, "</FORM><BR>\n")
|
||||
}
|
||||
|
||||
@@ -146,23 +157,38 @@ func imgServer(out http.ResponseWriter, req *http.Request) {
|
||||
func (w wrpReq) capture(c string, out http.ResponseWriter) {
|
||||
var pngbuf []byte
|
||||
var gifbuf bytes.Buffer
|
||||
var loc string
|
||||
var err error
|
||||
|
||||
// Navigate to page or process click request
|
||||
if w.X > 0 && w.Y > 0 {
|
||||
log.Printf("%s Mouse Click %d,%d\n", c, w.X, w.Y)
|
||||
chromedp.Run(ctx,
|
||||
chromedp.MouseClickXY(int64(float64(w.X)/w.S), int64(float64(w.Y)/w.S)),
|
||||
chromedp.Sleep(time.Second*3),
|
||||
chromedp.Location(&loc))
|
||||
err = chromedp.Run(ctx, chromedp.MouseClickXY(int64(float64(w.X)/w.S), int64(float64(w.Y)/w.S)))
|
||||
} else if len(w.F) > 0 {
|
||||
log.Printf("%s Button %v\n", c, w.F)
|
||||
switch w.F {
|
||||
case "Bk":
|
||||
err = chromedp.Run(ctx, chromedp.NavigateBack())
|
||||
case "Bs":
|
||||
err = chromedp.Run(ctx, chromedp.KeyEvent("\b"))
|
||||
case "Rt":
|
||||
err = chromedp.Run(ctx, chromedp.KeyEvent("\r"))
|
||||
case "<":
|
||||
err = chromedp.Run(ctx, chromedp.KeyEvent("\u0302"))
|
||||
case "^":
|
||||
err = chromedp.Run(ctx, chromedp.KeyEvent("\u0304"))
|
||||
case "v":
|
||||
err = chromedp.Run(ctx, chromedp.KeyEvent("\u0301"))
|
||||
case ">":
|
||||
err = chromedp.Run(ctx, chromedp.KeyEvent("\u0303"))
|
||||
}
|
||||
} else if len(w.K) > 0 {
|
||||
log.Printf("%s Sending Keys: %#v\n", c, w.K)
|
||||
err = chromedp.Run(ctx, chromedp.KeyEvent(w.K))
|
||||
} else {
|
||||
log.Printf("%s Processing Capture Request for %s\n", c, w.U)
|
||||
err = chromedp.Run(ctx,
|
||||
emulation.SetDeviceMetricsOverride(int64(float64(w.W)/w.S), int64(float64(w.H)/w.S), w.S, false),
|
||||
chromedp.Navigate(w.U),
|
||||
chromedp.Sleep(time.Second*3),
|
||||
chromedp.Location(&loc))
|
||||
)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
@@ -177,8 +203,11 @@ func (w wrpReq) capture(c string, out http.ResponseWriter) {
|
||||
return
|
||||
}
|
||||
|
||||
log.Printf("%s Landed on: %s\n", c, loc)
|
||||
w.U = loc
|
||||
chromedp.Run(
|
||||
ctx, chromedp.Sleep(time.Second*3),
|
||||
chromedp.Location(&w.U),
|
||||
)
|
||||
log.Printf("%s Landed on: %s\n", c, w.U)
|
||||
w.printPage(out)
|
||||
|
||||
// Process Screenshot Image
|
||||
|
||||
Reference in New Issue
Block a user