Hello everyone! It has been a long time since I talk about update for AnonSurf. Here’s my Ted talk about the problems that I’ve faced and my plan
I. Why it’s taking so long
My original plan was rewriting AnonSurf front-end in Vala and combine with old Nim code as backend. However, 2 programming languages have different memory management, hence program crashes everytime a string is handled. Hence I have to rewrite everything in Vala, which is ugly IMO. Vala with Java-like syntax is nice writing GTK objects. However, rewrite the backend with a ton of handling stuff is not something I like.
II. Technical difficulty
My scope was “simple”:
Focus on the front-end first. I’d make a new interface that’s simple, remove some backend functions
Completely remove anything handles GUI (notification for example) in CLI.
But it’s not that simple. The highest priority requires me rewrite everything in Vala. But why rewrite in Vala? Vala is officially supported by GTK. Meanwhile, Nim is a great language, but GTK binding causes many problem:
It’s known that the anonsurf gui crashes on other platform
Nim’s Gintro (GTK binding of Nim) won’t be supported in the future. It’s official by the dev
The way Nim handles memory and variables makes it hard to make GTK binding. For example: callback event of a button can pass only 1 parameter.
An other idea is to stop using subprocess to call command service (the recent bug command service not found is NOT anonsurf’s problem but parrot-menu instead). However, the only solution I could find is to use D-BUS. Technically, It’s doable managing systemd services using D-BUS. However, the D-BUS channel doesn’t exist if the service didn’t start (rightttttt). So this method is impossible If the GUI app wants to start AnonSurf service (and I couldn’t found a solution for it)
And the final ultimate problem: grant authorized permission for start / stop and saving options. Technically the program run as normal user (in sudoer group) and I want some functions run as root. There are some topics on internet asking about granting permission but all solutions end with using pkexec (a sub process)
That being said, all new ideas are impossible. I have to stick with old methods in new language.
III. Front-end change
The GUI will have a new interface which has more information but more simple. Runtime memory should be decreased. I will drop the options dialog (option still exists though). That will get rid of technical issues i mentioned above, and get rid of libprce dependency.
And as I mentioned above, terminal version won’t have system’s notification. However, it also means the quick launchers in the menu won’t have start / stop launchers anymore.
IV. Support I2P in the future
I would like to have an option in the settings that supports I2P instead of only Tor. There will be more functions in anonsurfd script to support that. This is the first time I work with I2P so I hope I won’t fuck it up
nice @CrackMap . I use something similar to this config also. Any json file to avoid a manual config. Don’t get me wrong, the manual method allows users to understand what they are doing before upgrading to json file for automatic browser read. also users might find this helpful to check for browser leaks: https://coveryourtracks.eff.org/ or https://browserleaks.com/
9ice!..I actually access tor over using pi with Kali/Parrot. only issue is Tor browser does not support Raspberry PI as it uses an ARM architecture and does not support SSE2. so PI users have to use Firefox over tor. This is a good script to help along the journey for Firefox users over tor network, I did add some additional modification but you get the point user.js - brainfucksec · GitHub … based off the creepjs work link you shared this is also a good privacy leak checker : TZP
After days struggling with the Dialog object (mostly my bad calling wrong method), I added some new lines of code. From now on, system tray’s menu and the title bar will be updated as well as the normal layout. So instead of normal “static” menu, it’ll have “start” or “stop” depends on if surf is running. Meanwhile the title bar will shows the status of anonsurf, replacing the big status Box like in previous version.
Vala helps me produce much cleaner code compare to previous version in Nim, and the syntax helps a lot making the refresher for title bar and system tray’s menu. Cheers!
hahaha… every dev’s nightmare is variable naming… also it would be greater if Anon Surf implements dynamic ip changes for Tor. I currently use Aut (great application too), but the dynamic ip is for web surfing and does not encapsulate the whole NIC like Anon Surf, but it is also great.
I’m very confident to say that major parts of AnonSurf is completed. And I have some idea to optimize the GUI, making sure it wont waste resource in the background (and hopefully it helps laptop’s battery’s life even this GUI won’t take so much resource).
I hope this is the last major development change of AnonSurf, so next versions will be improve backend’s quality and update new build following GTK’s update and Tor’s update only.
Yeah it’s kinda huge update. Code base isn’t that large, but connect all the functions take time. I’m working on optimizing the refresh GUI method which ends up modifying other methods in almost all objects. So I can’t tell when AnonSurf is completed.
An other task is rewrite communication with Tor’s control port in Vala. That shouldn’t be hard. The rest should be easier.
So I completed the Change ID using Tor’s socket control port. I should’ve done it sooner but I simply felt no energy. So the entire work left:
Rewrite (or rework on structure, not entirely rewrite it) CLI; add comments and other stuff to all functions, drop old Nim code, … That’d bring a lot of headache.
Improve front-end a bit (button’s size, English, …). I must make the GTK work in a “headless” mode too (which allow users to use it from XDG menu)
I would like to use Tor control port to check if Tor is connecting fine but there’s no solution.
Consider checking DNS status and sort of config’s parser to get control port from config file.
(edit): Complete VTE module
Basically after first object, AnonSurf is ready to be tested.
P/s: I’m getting a lot of Vala’s warns in C level (C-generated from Vala). Hopefully I can find some way to fix them all. That’s annoying.
The left area is not completed. It is showing the status of anonsurf at boot. I have no new idea for it so i’m having it as place holder for now. Meanwhile, as you can see, options dialog is removed completely. The option is still supported by maketorrc, saving at /etc/anonsurf/. I might expand this feature in the future. It all depends on Tor’s settings.
An other change is the current status of AnonSurf is displaying in Title bar, which saves a lot of pixels. I kinda like it.
A member in the team suggested using Switch for button that enable / disable AnonSurf at boot. That’s an amazing idea. After 9 hours working with undocumented signal events, I finally made it work.
AnonSurf is now basically completed. I’m trying to complete low priority tasks to complete it, including code quality, improve Debian build and so on. Users can now try build and run AnonSurf.
GUI should use much less RAM (about 12.5 MB on my machine. It could be different depends on hardware?). AnonSurf in system tray only (close window) should use much less CPU compare to window and system tray
Better code quality, better makefile. Debian build should have no errors
Some known problems:
VTE (spawn nyx is showing runtime warning. It didn’t happen with Nim GTK so I have to find a workaround)
Anonsurf GTK is able to spawn multiple window instead of only 1. It didn’t happen before (i believe?) with Nim version. I’m still working on it
There’s no “headless” version with anonsurf-gtk yet (the way to click on the launcher to start / stop anonsurf. Current build is still using cli so it has no system notifications).
There’s a bug that if user upgrades from current version to current build (debian package), it shows duplicate file. User can either remove old version, then install this version, or wait for a patch fix
p/s: I’m still finding workaround for problems, including improve Debian build, code logic, … so current version is still unstable. It depends on which feature is being modified.
Multiple systray icon is created (and overlap each other in system tray area). It happens whenever use starts another anonsurf-gtk process. At least I fixed multiple window spawns. I’m still finding a solution for this stupid problem.
Restore AnonSurf GTK from system tray icon either crashes or shows nothing, depends on if Window is ApplicationWindow or Window object of GTK. There’s a solution for this, but it creates the problem making a new systray icon overlaps the current one (as same as 1st problem).
I finally find the reason of multiple system tray icons glitch. Turned out that’s Gtk.main() creates it. Now I have to rewrite the logic of creating Window and System tray icon from scratch, hopefully I can fix the issue. It took me entire 2 days to fix the same issue again and again. If these 2 bugs are fixed, we are gonna have the first beta testing.
The 2 major issues are FIXED. I can’t believe the root-cause of this problem is a signal that’s barely used in official example. Some small issues of VTE were fixed too. I have to rewrite the “headless” mode (I’ve removed it) later but it’s very very easy to do. Technically current AnonSurf is ready to test.