rejetto forum

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - NaitLee

Pages: 1 2 3 ... 14
1
Everything else / Let things calm down
« on: April 29, 2022, 06:35:32 PM »
This topic is relative to https://rejetto.com/forum/index.php?topic=13535.msg1067427#msg1067427

Let things calm down. I can't persuade further since it will make things go worse.



They are still false positives.

Gibberish code, just crackers trying another non-sense protocol (possibly HTTPS).

Bell ring, a common concept of Windows CMD/PowerShell, when there's a BELL (0x07) character, Windows will just ring, to alarm something. It's along with above circumstance.

Connect? Just another non-sense that try to horrify you.
Just compare the CONNECT with GET or POST. The difference is servers just don't understand it and won't do anything.
No request methods except GET, HEAD and POST will work, in that script.

Code: [Select]
# Example. Try in unix-like environment and modify as need
echo -e -n "CONNECT google.com:443 HTTP/1.1\r\n" | socat tcp-connect:127.0.0.1:8081 -
# it won't do anything wrong in either side

For other things else, I think I could stop, "guessing" as said. I don't want to be superhero, anyway. Do what you like & think best.



Losing trust is terrible. Even more terrible if it's all caused by outsider stalkers. Terrible for both person. Yet more if plus region things.

Now that even if I do more, useless.

Hope everything will go well, without me.

Goodbye.

2
NaitLee, it's a good suggestion to show it somebody. Because it's not my cup of coffee but I 'l'l show your release to folks from https://sloboda-studio.com/python-development-services/ .Hope they answer sth to me ) Thank you in advance!

Hello,

Thank you for doing something. Though I still don't understand the purpose of this (about Work? sorry maybe I'm still too young), it's good that ones care about me.

While I haven't updated PHFS for a long time and it's somewhat outdated, I personally use it almost everyday -- just beside HFS 2/3 for its familiarity & I-know-the-best.

These days I'm working on another project (not related to HFS, but still Python/Server&Client/App): Cat-Printer
It's still like that, few dependencies & less overhead, for everyone from newbies to geeks, and if you just say "quality" it could satisfy you!

Also worth to note is that, considering something like React, I don't like it and don't want to do. Though it's so-called "a must" in many places, it's not for me, in technology or philosophy.
It's said that: why React or whatever? If it can do, why pure javascript can't? Why pick the complete opposite to your purpose?
The same applies to Python etc. PHFS have just two dependencies: wsgiserver and werkzeug. The later is a part of Flask, though I didn't use the whole thing. The other is yet just a basic & fast WSGI "entrance". I prefer few deps, since I don't like it (messy), users don't like it (too big & slow), every developer in fact doesn't like it (hard to manage & maintain).
Maybe my thoughts have conflicts to people. But that's just what I think. I don't like so-called "profession", I just want to make everything be what it should be -- usually simple enough, to be accepted by many one, if not every.
Remember UNIX philosophy? Do one thing, and do it well.

The other matter, I haven't tried Docker etc yet. I still need development in many directions, and experience. It's a far road to be true full-stack.

I could of course do applications & satisfy users now. And I have the ability to learn -- that's the usually being ignored, but most important one.

Thank everyone again, for your kindness to everyone that matters.

3
Right, one can make several domain names point to the same address but just differ the port.

The drawbacks are a) need to share the port along with address, b) maybe extra work to manage HFS instances & all VFS files

btw HFS url config make no use at how the server works -- it is used only for URL building :)

4
Sorry that I've changed something before but forgot to say.  :-[
You need absolute path in middleware -v parameter: (put slash at beginning)

-v folder1,/folder1 folder2,/another/folder2

Paths are still corresponding to HFS virtual dir structure.

I just implemented some banning mechanisms. The script structure is not that good, and I should clean it later.
It prevents some common attack attempts while banning that bad client. While this may be too "violent" for casual curious guys.
Things happened are available in file banlist.txt
You can test it anyway. See attachment. :)

5
HFS ~ HTTP File Server / Re: a new beginning...
« on: April 23, 2022, 12:25:50 PM »
I don't interested in Node for some reasons. But I wonder if there will be a template engine, just like the old classic HFS2.

It's a very interesting coincidence that I've said something very similar before ::)
The difference is that I took the opportunity to make one out.

While I've already done an engine in my PHFS, I want a totally new start.
And that means it will take some time...

EDIT: it's actually the same sentence. I'm wondering if this is bot...

6
For the attack:
- Not me! My local network/Internet service (provider) structure don't even allow such kind of public access.
- Nothing except the IP address is meanful for analysis.
  So just block/ban the address, in HFS or System (Windows) Firewall.
  An "if" condition in this middleware can also do it.
Code: [Select]
    def do_whatever(self):
        'Just proxy through'
        if self.client_address[0] in ('162.221.192.90', ): # you can add more
            return
        host = self.headers.get('Host')
        # ...

EDIT: I see crack/attack prevention a good/interesting point to discover. I would like to try to do it and see if it would work well.
Middleware could see what's going on, and we can analyze things inside.

7
First that sorry for the inconvenience, I didn't expect that it's a big trouble for big-scale users.
One thing to clarify is, I wrote the Python script all by sincere and no malicious thing. I'll never fault anyone.
Some common points were concerned but one is missing: the "Server" HTTP header.
The script did nothing to it, and Python BaseHTTP keeps it's default: Python/<version> BaseHTTP/<version>
This way bad bots could identify that and trying to exploit it with their "common sense" in brute. But of course it will never work except taking network traffic.
To change it is easy. But in your case it's still not so well: the big-scale use case nature is somewhat out of my scope :-[
To filter these spikes is also possible, though needs extra work.

For now under class MiddlewareHandler put these:
Code: [Select]
    def send_response(self, code, message=None):
        self.log_request(code)
        self.send_response_only(code, message)
This removes Server header exposure, by overriding parent class method.
I'll update the code attachment. Please update as it fixes another thing.

You can of course use other port.
The -b is for middleware to "bind" an network address, (ex. "-b 127.0.0.1" for only listening to localhost (that is, only your computer could access it), and any other.)
The "opposite" -d is to tell "where is HFS". Default to localhost.
Same applies to "-p" for middleware to use a port and "-q" to tell what is HFS port.

Answers:
1. Maybe yes. But you can use other ports freely with -p parameter
2. See above. You can know more about "address binding" from internet
3. Also see above. Don't take pressure, the difference is just "letter direction" and "whether middleware or HFS"
4. Ex. with HFS 2.4 default template you can see the directory "breadcrumbs" still contains "project1" etc, even though proxied.
5. Yes!

8
Hi,

I've tried event script but didn't find a way either...

Once I'm thinking about a "middleware" for HFS 2 to enhance it in a flexible way.

Though I didn't do it earlier, today I took some time to investigate such thing, and by the way did what you may want: "virtual host" :D

I put my work in attachment, if you can do command line & installed Python >= 3.8, it's very easy to get started.

- Install Python, if not yet there
- Extract to somewhere, if on Windows, right-click while pressing Shift, open CMD or PowerShell.
- Inside invoke middle.py, let's say you want the middleware be at port 80, and let HFS 2 listen 8080:
  py middle.py -p 80 -q 8080 -v project1.duckdns.org,/public_websites/project1 project2.duckdns.org,/public_websites/project2
  (you can put this content in file start.bat and start it by double-clicking later)
- Now go to http://127.0.0.1:80/ and see if it works. (Note: now visiters should use port 80 rather than 8080)

There are also parameter -b and -d to listen other addresses. For more help use -h.
That means you can middleware HFS on another computer.

There are also some drawbacks, for example (currently) slower, and HFS sometimes exposes an absolute link that have the "true" path (though still can't access "true" root directory).

This is not yet considered a "project". Further development not guaranteed...
But fixes in short term is accepted :)

9
HFS ~ HTTP File Server / Re: how to inline images in folder view
« on: April 18, 2022, 04:45:11 PM »
thanks, and thanks ^^ was kindof hoping to avoid needing a list of image formats filenames, given that HFS already seems to know what formats are images and what isn't... but since that info seemingly isn't added to the HTML, i guess it's nearly unavoidable :( also you forgot "jfif" and "bmp" and "ico" ! i don't know what jfif is exactly, but it's some kind of obscure image format, because HFS knew its an image (the screenshots in the top post actually contains a jfif ^^)

To tell truth, HFS doesn't know "much" -- it's because a Windows system applications have support, and associated to the file extension to open it directly. You can see the icon is from that application. HFS just see you're listing the file, then query Windows (just) for an icon.

The way Web (browser) know what's it is "MIME type". HFS have some common MIME types built in, but not eg. jfif.

I tried to make jfif image but both GIMP and ImageMagick didn't work. It's so rare...
(KDE desktop lists it as a kind of "JPEG image")

But since you already know the way, adding few more isn't a big deal, right? ;D

... messy? try looping an array:
Code: [Select]
['.jpg', '.png', '.gif', '.webp', '.jfif', '.bmp', '.ico'].forEach(function(t) {

    document.querySelectorAll('a[href$="' + t + '"i]').forEach(function(e) {
        // ...
    });
});
(jfif not guaranteed to show in browser)

10
HFS ~ HTTP File Server / Re: how to inline images in folder view
« on: April 17, 2022, 06:23:46 AM »
Hi,

Great DIY job :D

To ignore the dynamic icon problem, in your code replace the selector-parent-each line with this:

Code: [Select]
document.querySelectorAll('a[href$=".jpg"i],a[href$=".png"i],a[href$=".gif"i],a[href$=".webp"i]').forEach(function(e) {

And replace all "this" as "e". Well done. :)

This seems straightforward to you and no need to explain ;D



Yes, I still love the HFS 2 philosophy, and in my own view things like Electron and React have ruined everything JavaScript brought to us.

Actually it's so glad that rejetto tried to make HFS 3 without too much (compared to other), and in fact we can directly change the (even after compilation) server code.
(I know rejetto may feel it inappropriate, but I found and reported some bugs in a way of tracing the compiled code)
In contract the react frontend have no such luck, though we have plugins.

I don't know when I'll actually make "template in HFS 3" be real (planned far ago). I'm busy on other things these days to obtain some inspiration.
Another previously untold idea is a native UI with something like tcl/tk, to mimic HFS 2 ::)

11
Beta / Re: version 2.4
« on: April 04, 2022, 12:43:26 PM »
The HFS 2 "dying" problem is around there long time ago,
it's (very likely) just because the application structure of underlying tech (delphi) that's not suitable for a server.
Many people are thinking or complaining, but the truth is that it can't be fixed easily on HFS 2 itself :'(

Few days ago I come up an idea about a small middleware for HFS 2, that can have additional features on server regulation.

In my mind it can, for example, when a file is requested, send the file by itself while let HFS rest & just do lightweight jobs (then proxy though the middleware).
(Note: just big network flow would stuck HFS)
And also something like page caching, along with many more tricks... ::)
Of course permissions are obeyed, the main role is still HFS :D it's behavior is totally controlled by HFS (with event script, I think)

While everybody use HFS for it's simplicity, a silent and friendly middleware won't trouble much, right? :)

The sad side is I've promised to 2 long-term development things and I'm unable to make it in a short period :(
Let me meet a chance and pick some time to try it...

12
HFS ~ HTTP File Server / Re: hfs 3 logo
« on: April 03, 2022, 12:32:04 PM »
The reverse-slanted symbol is, first digit "3" simply for "HFS version 3", then... well I forgot what I'm thinking about that time :P
A little trick in logo is by thinking about some random shape first then squeeze some meanings out ;D

Also, doing logo isn't that hard, you can always scribble curve borders with bezier curve with mouse, and do whatever (like filling or stroking it)
If the shape is complex, there's potrace, to trace a vector image (though only result in black and white) out from bitmap

BTW the GIMP have both vector "paths" and selection-to-path feature, that can also be a "manual" version of vector tracing.
You can export a "path" out, that will be SVG format... and the program itself is preferred to do all the fancy things about bitmap... :)

13
HFS ~ HTTP File Server / Re: hfs 3 logo
« on: April 03, 2022, 05:15:53 AM »
I suddenly remembered months earlier I've tried to make one, and it's actually done...
Sorry if it's late, but just take a look :D

It's, emm, of course my style, that is "unreal", "fantasy" or "virtual", in cyan color...
In case there's inspiration to make better, just do it :) no copyright stuff here (yet)

Attachment is a zip with logo SVG inside, Inkscape metadata included for further modification.
The font used is "Nasalization". I remember I took it from around here.
It have small canvas size, though, so just zoom properly

14
HFS ~ HTTP File Server / Re: How can I set up a simple redirect?
« on: March 23, 2022, 12:31:33 PM »
In HFS main window, press Alt+F6 to open "event script", inside put this:
Code: [Select]
[download]
{.set|path|{.decodeuri|%url%.}.}
{.if|{.=|{.cut||4|{.^path.}.}|/123.}|{:{.redirect|/000{.cut|5||{.^path.}.}.}:}.}

Press Ctrl+S to save it.
With this users can view /123 but when they download something they will get from /000
This is explicit, users will see the redirection in address bar.

To edit this, let's say redirect /photo to /picture:
- change /123 to /photo
- change /000 to /picture
- change 4 to 6, i.e. the length of "/photo"
- change 5 to 7, i.e. length of "/photo" +1

Know more about macro "cut" at here

In case your folder name have non-ascii characters, be sure to save the event script in UTF-8 encode

15
Hi,

In the HFS window, press Alt+F6 to open "event script", put the following inside:
Code: [Select]
[request]
{.if|{.!=|{.header|Host.}|mydomain.com:8080.}|{:{.disconnect.}:}.}
Replace the domain name with yours, and omit the port if it's 80
Save it with Ctrl+S. Now HFS will disconnect any browser request not coming from the domain.

In order to allow localhost/127.0.0.1, use this:
Code: [Select]
[request]
{.if|{.and|
{.!=|{.header|Host.}|localhost:8080.}|
{.!=|{.header|Host.}|127.0.0.1:8080.}|
{.!=|{.header|Host.}|mydomain.com:8080.}
.}|{:{.disconnect.}:}.}
This is a whitelist pattern. You can put even more.

These can't prevent request header forgery, though. But this is very rare for normal people with a normal browser...

Pages: 1 2 3 ... 14