ZeroNet Blogs

Static ZeroNet blogs mirror

ZeroMe, nuevos aires

- Posted in 🕵 D a r k b l o G 🕵 by with comments

Twister aterriza en ZeroNet para darle algo mas de vida a la decaida comunidad y al parecer esta dando sus resultados... su nombre es ZeroMe y tambien con version extendida, ZeroMe+


ZeroMe y ZeroMe+


ZeroMe y ZeroMe+ son dos redes sociales al estilo de Twitter, con funcionalidades limitadas, pero en crecimiento.


En funcionalidades, Twister va dos pasos adelante... con soporte para tags (o hashtags), imagenes y multimedios, ademas de mensajes privados y otros detalles.


Por el momento, ambas redes en ZeroNet soportan lo basico, envio de mensajes, seguimiento, y formateo de texto.

Como crear nuestra cuenta?


Al entrar en una de esas redes solo debemos identificarnos y crear nuestro perfil. Esto nos llevara a tener que entrar o adscribir a algunos de los grupos o circulo de contactos que ahi existen.


Este procedimiento nos llevara algunos minutos y necesitaremos algo de tiempo para completar todo el procedimiento.


Si tenemos configurado nuestro nodo ZeroNet con Tor es posible que todo el procedimiento pueda interrumpirse de vez en cuando y tengamos que volver a intentarlo.


Cuidar un poco nuestra intimidad en tiempos de los servicios de inteligencia tiene su precio.


Se que esta micro-guia es un asco, ya que no explica en detalle como comenzar en estas redes, pero espero que a mas de alguno lo pueda ayudar aunque sea un poquito a dar sus primeros pasos.

ZeroMePlus y sus agregados


Lo principal que nos proporciona esta opcion son los filtros: Clasificar a los usuarios en Relevantes, Aleatoriamente, Todos y la posibilidad de hacer busquedas.


Por lo demas, tambien nos proporciona la capacidad de bloquear o definir a usuarios como spammers o simplemente los mensajes como pesimos.


Por el momento seguirme explorando sus posibilidades.

Y recuerden: Nunca dejar corriendo ZeroNet sin un proxy falso para evitar escapes de informacion.


[翻译]ZeroNet 站点开发教程 #2

- Posted in YSC's blog by with comments

原文链接: ZeroNet site development tutorial #2

第一部分 我们使用了一些简单的 ZeroFrame API 调用创建了一个 ZeroNet 站点。

We going to extend it to accept, store and query messages using a SQLite database and use ZeroID to identify user names.

The final page and source code is available at https://www.zerogate.tk/1AvF5TpcaamRNtqvN1cnDEWzNmUtD47Npg


添加 ZeroID 用户选择

Add a new link to index.html that will allow us to select the ZeroID identity we want to use:

<html>
<body>
<a href="#Select+user" id="select_user" onclick='return Page.selectUser()'>Select user</a>:
<input type="text" id="message"><input type="button" id="send" value="Send!"/>
<ul id="messages">
 <li>Welcome to ZeroChat!</li>
</ul>
<script type="text/javascript" src="js/all.js" async></script>
</body>
</html>

To make it work add a function to js/ZeroChat.coffee that displays the certificate selection dialog to user:

    selectUser: =>
        Page.cmd "certSelect", [["zeroid.bit"]]
        return false

As parameter you should include the accepted certificate provider names. (zeroid.bit here)

If you hit a refresh and click on "Select user", then you should see the dialog, but nothing changes when you select your zeroid certificate.

显示用户当前的 ZeroID 账户

When something is changed that affects the site (new content arrived, user changed, etc.) a websocket event will be pushed to your browser. (the format is same as you query setSiteInfo command)

To handle this event add this function:

    route: (cmd, message) ->
        if cmd == "setSiteInfo"
            if message.params.cert_user_id
                document.getElementById("select_user").innerHTML = message.params.cert_user_id
            else
                document.getElementById("select_user").innerHTML = "Select user"
            @site_info = message.params  # Save site info data to allow access it later

This code will real-time update the user's currently selected user name.

To also update the user name on page load modify the onOpenWebsocket function:

    onOpenWebsocket: (e) =>
        @cmd "serverInfo", {}, (server_info) =>
            @addLine "serverInfo response: <pre>" + JSON.stringify(server_info,null,2) + "</pre>"
        @cmd "siteInfo", {}, (site_info) =>
            @addLine "siteInfo response: <pre>" + JSON.stringify(site_info,null,2) + "</pre>"
            # Update currently selected username
            if site_info.cert_user_id
                document.getElementById("select_user").innerHTML = site_info.cert_user_id
            @site_info = site_info  # Save site info data to allow access it later

设置用户内容权限 (content permissions)

To allow users to post on our site we have to define the rules of the third-party content.

Create a data/users directory and create a data/users/content.json file in it:

{
  "files": {},
  "ignore": ".*",
  "modified": 0.0,
  "signs": {},
  "user_contents": {
    "cert_signers": {
      "zeroid.bit": [ "1iD5ZQJMNXu43w1qLB8sfdHVKppVMduGz" ]
    },
    "permission_rules": {
      ".*": {
        "files_allowed": "data.json",
        "max_size": 10000
      },
      "bitmsg/.*@zeroid.bit": { "max_size": 15000 }
    },
    "permissions": {
      "bad@zeroid.bit": false,
      "nofish@zeroid.bit": { "max_size": 100000 }
    }
  }
}
  • "ignore": ".*",: When the site owner signing this content.json don't add any file to it, they will be signed by the users.
  • cert_signers: We accept *@zeroid.bit users and they have to come with a cert that is has to signed by 1iD5ZQJMNXu43w1qLB8sfdHVKppVMduGz address.
  • permission_rules: We give 10kbytes of space to every user (15kb if registered using bitmessage)
  • permissions: Per-user permissions: ban bad@zeroid.bit user and allow 100k storage to nofish@zeroid.bit user. ( it's me :) )

After we saved this file we have to modify our root content.json to also ignore files in this directory and load the file containing the rules:

  ...
  "ignore": "data/.*",
  "includes": {
    "data/users/content.json": {
      "signers": [],
      "signers_required": 1
    }
  },
  ...

Note: You can give moderation permissions to other users by adding addresses to "signers" list.

Now we have to sign the data/users/content.json file using the following command: zeronet.py siteSign [siteaddress] --inner_path data/users/content.json

添加消息到我们的 json 文件

When hitting the Send button we going to add the message to our data.json file, sign it, then publish it to other users.

  • First add the onclick="return Page.sendMessage()" event listener to Send input button html tag.

  • Then create a new function in ZeroChat.coffee:

    sendMessage: =>
        if not Page.site_info.cert_user_id  # No account selected, display error
            Page.cmd "wrapperNotification", ["info", "Please, select your account."]
            return false

        inner_path = "data/users/#{@site_info.auth_address}/data.json"  # This is our data file

        # Load our current messages
        @cmd "fileGet", {"inner_path": inner_path, "required": false}, (data) =>
            if data  # Parse if already exits
                data = JSON.parse(data)
            else  # Not exits yet, use default data
                data = { "message": [] }

            # Add the message to data
            data.message.push({
                "body": document.getElementById("message").value,
                "date_added": (+new Date)
            })

            # Encode data array to utf8 json text
            json_raw = unescape(encodeURIComponent(JSON.stringify(data, undefined, '\t')))

            # Write file to disk
            @cmd "fileWrite", [inner_path, btoa(json_raw)], (res) =>
                if res == "ok"
                    # Publish the file to other users
                    @cmd "sitePublish", {"inner_path": inner_path}, (res) =>
                        document.getElementById("message").value = ""  # Reset the message input
                else
                    @cmd "wrapperNotification", ["error", "File write error: #{res}"]

        return false
  • After this is done type something to the message input and press the Send! button! You should see the message in the data/users/[your auth address]/data.json file.

创建数据库

Now we can save and publish our messages to other users, let's display it in our application! The best way to do this is map all data.json files to an SQL database.

The ZeroNet automatically do this for you, all you need is a dbschema.json file in your site's directory that describe your table structure:

{
    "db_name": "ZeroChat",
    "db_file": "data/zerochat.db",
    "version": 2,
    "maps": {
        "users/.+/data.json": {
            "to_table": [ "message" ]
        },
        "users/.+/content.json": {
            "to_keyvalue": [ "cert_user_id" ]
        }
    },
    "tables": {
        "message": {
            "cols": [
                ["body", "TEXT"],
                ["date_added", "INTEGER"],
                ["json_id", "INTEGER REFERENCES json (json_id)"]
            ],
            "indexes": ["CREATE UNIQUE INDEX message_key ON message(json_id, date_added)"],
            "schema_changed": 1
        }
    }
}
  • "db_name": "ZeroChat": Used only for debugging
  • "db_file": "data/zerochat.db": The SQLite database file will be stored here
  • "version": 2: Define the json table structure, version 2 is better suited to ZeroID based sites. More info in the reference docs.
  • "maps": {: Describe the json files -> table conversion
  • "users/.+/data.json": { "to_table": [ "message" ] }: Put the data from every user data.json file message node to message table.
  • "users/.+/content.json": { "to_keyvalue": [ "cert_user_id" ] }: Store the user's authentication id in simple key/value structure.
  • "tables": {: Describe the table and indexing structure.
  • ["json_id", "INTEGER REFERENCES json (json_id)"]: Every table should contain a json_id column, it defines the source file path.
  • "schema_changed": 1: Increment this when you change the table structure, so the peers can drop the table and re-create it from the json files.

Tip: For the best performance always create an index for json_id column in your tables, because when new file arrives the data will be updated based on this column.

Execute zeronet.py dbRebuild [your site address] command to generate database from current files.

The data/zerochat.db SQLite file will be created, to browse these files I recommend using SQLiteStudio (it's free and opensource)

At this point you have to restart your ZeroNet client to detect and manage your site's newly created database.

显示消息

As the messages are now it the SQL database we can query them using the dbQuery command:

    loadMessages: ->
        @cmd "dbQuery", ["SELECT * FROM message ORDER BY date_added"], (messages) =>
            document.getElementById("messages").innerHTML = ""  # Always start with empty messages
            for message in messages
                @addLine message.body

Add the @loadMessages() line to onOpenWebsocket function, then reload the page and you should see the messages you typed in.

To make it "real time" and display new messages immediately as they come in you have to add the @loadMessages() to the route part:

    route: (cmd, message) ->
        if cmd == "setSiteInfo"
            if message.params.cert_user_id
                document.getElementById("select_user").innerHTML = message.params.cert_user_id
            else
                document.getElementById("select_user").innerHTML = "Select user"
            @site_info = message.params  # Save site info data to allow access it later

            # Reload messages if new file arrives
            if message.params.event[0] == "file_done"
                @loadMessages()

And also reload the data when we submit a new message:

    sendMessage: =>
        ...
            # Write file to disk
            @cmd "fileWrite", [inner_path, btoa(json_raw)], (res) =>
                @loadMessages()
                ...
        ...

That's it! Now the messages are updated in real-time! You can try it by opening an another browser window and enter a messages there.

显示 ZeroID 用户名

To display the sender user name we have to create a more complex SQL query, because the user names are stored in content.json file and the messages are in data.json.

+ we will also escape the incoming messages to disallow html codes.

    loadMessages: ->
        query = """
            SELECT message.*, keyvalue.value AS cert_user_id FROM message
            LEFT JOIN json AS data_json USING (json_id)
            LEFT JOIN json AS content_json ON (
                data_json.directory = content_json.directory AND content_json.file_name = 'content.json'
            )
            LEFT JOIN keyvalue ON (keyvalue.key = 'cert_user_id' AND keyvalue.json_id = content_json.json_id)
            ORDER BY date_added
        """
        @cmd "dbQuery", [query], (messages) =>
            document.getElementById("messages").innerHTML = ""  # Always start with empty messages
            for message in messages
                body = message.body.replace(/</g, "&lt;").replace(/>/g, "&gt;")  # Escape html tags in body
                @addLine "<b>#{message.cert_user_id}</b>: #{body}"

最后的更改

  • We can remove the site siteInfo and serverInfo debug messages:
    onOpenWebsocket: (e) =>
        @cmd "siteInfo", {}, (site_info) =>
            # Update currently selected username
            if site_info.cert_user_id
                document.getElementById("select_user").innerHTML = site_info.cert_user_id
            @site_info = site_info  # Save site info data to allow access it later
        @loadMessages()
  • Send messages by hitting Enter:
<input type="text" id="message" onkeypress="if (event.keyCode == 13) Page.sendMessage()">
  • And add some CSS style to make it look better
<style>
* { font-family: monospace; line-height: 1.5em; font-size: 13px; vertical-align: middle; }
body { background-color: white; }
input#message { padding: 5px; width: 50%; height: 34px; }
input#send { height: 34px; margin-left: -2px; }
ul { padding: 0px; }
li { list-style-type: none; border-top: 1px solid #eee; padding: 5px 0px; }
li:nth-child(odd) { background-color: #F9FAFD; }
li b { color: #3F51B5; }
</style> 
  • After you edited any file never forget to sign and publish the modifications!
zeronet.py siteSign [your site address] --publish

恭喜! Now you have a server-less, pure P2P, SQL backed chat application! :)

本站已注册.bit域名

- Posted in YSC's blog by with comments

感谢 @domains4free 为我注册的域名 ysc3839.bit

教程参考: 东先生的ZeroBlog - 在ZeroNet注册一个免费的.bit域名 0List Blog - Free .bit Domains

ZeroNet и литература

- Posted in __br☣m__.py by with comments

Недавно я прочитал одну книгу, и наткнулся там на описание некой "крепости":

“– Они говорят, что все началось с общего килл-файла. Ты знаешь, что такое килл-файл? – Нет. – Очень древнее понятие. Способ уклоняться от нежелательной входящей корреспонденции. Килл-файл не пропускал эту корреспонденцию, она для тебя все равно что вообще не существовала. Это было давно, когда сеть была совсем еще молодая. Кья знала, что, когда родилась ее мать, сети вообще не было или там почти не было, хотя, как любили говорить школьные учителя, такое даже трудно себе представить. – А как могла эта штука стать городом? И почему там все так стиснуто? – Кто-то загорелся идеей вывернуть килл-файл наизнанку. Ну ты понимаешь, это не то, как в действительности все было, а как это рассказывают: что люди, основавшие Хак-Нам, разозлились, потому что сперва в сети было очень свободно, можно было делать все, что ни захочешь, а потом пришли компании и правительства со своими соображениями, что тебе можно делать, а чего нельзя. Тогда эти люди, они нашли способ высвободить хоть что-то. Маленькую территорию, кусочек, клочок. Они сделали что-то вроде килл-файла на все, что им не нравилось, а сделавши, они вывернули его наизнанку”. Уильям Гибсон, “Идору” Возможно эта цитата не до конца раскрывает суть моего послания, но это все что мне удалось найти в большой сети. В ходе книги рассказывается, что крепость, это некий распределенный мультиюзерный домен который... децентрализован и распределен между всеми ее жителями. Ничего не напоминает? Однако книга эта написана в 1996 году. Похоже что люди давно грезили о чем-то подобном, однако, "Крепость" Гибсона это тоже не первоиссточник. Прототипом крепости в книге "Идору" да и прототипом муравейника в его серии книг "киберпространство" (известна по книге "Нейромантик") послужил Коулун (город-крепость). Коулун Коулун Если говорить в двух словах, то Коулун это государство в государстве, самоорганизовавшаяся структура полного беззакония и свободы. Самострой, рынок, проституция и наркоторговля...

Ужас на ночь

- Posted in __br☣m__.py by with comments

А вот вам перед сном то, что исторгает ZeroNet при попытки его запустить на текущем уровне переноса. Приложение не крашится, но и работать -- не работает.

И так:

brom@Brom:~/h/Zeropy3/ZeroNet$ ./zeronet.py 
- Starting ZeroNet...
[01:38:03] - OpenSSL load failed: invalid syntax (opensslVerify.py, line 208), falling back to slow bitcoin verify
[01:38:03] - Version: 0.4.1 r1525, Python 3.5.2 (default, Sep 10 2016, 08:21:44) 
[GCC 5.4.0 20160609], Gevent: 1.1.2
[01:38:03] - Creating FileServer....
[01:38:03] TorManager Tor controller connect error: ConnectionRefusedError: [Errno 111] Connection refused in TorManager.py line 154 > _socket3.py line 287
[01:38:03] - Creating UiServer....
[01:38:03] SiteManager Deleting orphan site from content.db: 1Name2NXVi1RDPDgf5617UoW7xA6YrhM9F
=====================
{}
[01:38:03] SiteManager Deleting orphan site from content.db: 19bhDQnHTh9Qww3XePT9EHn2AujGB6boFg
=====================
{}
[01:38:03] SiteManager Deleting orphan site from content.db: 1HeLLo4uzjaLetFx6NH3PMwFP3qbRbTf3D
=====================
{}
[01:38:03] Site:1Name2..hM9F Content.json not exist: data/1Name2NXVi1RDPDgf5617UoW7xA6YrhM9F/content.json
[01:38:03] - Removing old SSL certs...
[01:38:03] - Starting servers....
[01:38:03] UiServer --------------------------------------
[01:38:03] UiServer Web interface: <https://www.zerogate.tk/>
[01:38:03] UiServer --------------------------------------
[]
[01:38:03] - Unhandled exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/gevent/greenlet.py", line 534, in run
    result = self._run(*self.args, **self.kwargs)
  File "./src/Plugin/../../plugins/AnnounceZero/AnnounceZeroPlugin.py", line 71, in announceTracker
    request["hashes"].append(hashlib.sha256(site.address).digest())
TypeError: Unicode-objects must be encoded before hashing
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/gevent/greenlet.py", line 534, in run
    result = self._run(*self.args, **self.kwargs)
  File "./src/Plugin/../../plugins/AnnounceZero/AnnounceZeroPlugin.py", line 71, in announceTracker
    request["hashes"].append(hashlib.sha256(site.address).digest())
TypeError: Unicode-objects must be encoded before hashing
[01:38:03] - Unhandled exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/gevent/greenlet.py", line 534, in run
    result = self._run(*self.args, **self.kwargs)
  File "./src/Plugin/../../plugins/AnnounceZero/AnnounceZeroPlugin.py", line 43, in announceTracker
    tracker_protocol, tracker_address, fileserver_port, add_types, my_peer_id, mode
  File "./src/Site/Site.py", line 679, in announceTracker
    tracker = UdpTrackerClient(ip, int(port))
  File "./src/lib/subtl/subtl.py", line 45, in __init__
    self.peer_id = self._generate_peer_id()
  File "./src/lib/subtl/subtl.py", line 210, in _generate_peer_id
    numbers = [str(random.randint(0, 9)) for _ in xrange(remaining)]
NameError: name 'xrange' is not defined
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/gevent/greenlet.py", line 534, in run
    result = self._run(*self.args, **self.kwargs)
  File "./src/Plugin/../../plugins/AnnounceZero/AnnounceZeroPlugin.py", line 43, in announceTracker
    tracker_protocol, tracker_address, fileserver_port, add_types, my_peer_id, mode
  File "./src/Site/Site.py", line 679, in announceTracker
    tracker = UdpTrackerClient(ip, int(port))
  File "./src/lib/subtl/subtl.py", line 45, in __init__
    self.peer_id = self._generate_peer_id()
  File "./src/lib/subtl/subtl.py", line 210, in _generate_peer_id
    numbers = [str(random.randint(0, 9)) for _ in xrange(remaining)]
NameError: name 'xrange' is not defined
[01:38:03] - Unhandled exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/gevent/greenlet.py", line 534, in run
    result = self._run(*self.args, **self.kwargs)
  File "./src/Plugin/../../plugins/AnnounceZero/AnnounceZeroPlugin.py", line 43, in announceTracker
    tracker_protocol, tracker_address, fileserver_port, add_types, my_peer_id, mode
  File "./src/Site/Site.py", line 679, in announceTracker
    tracker = UdpTrackerClient(ip, int(port))
  File "./src/lib/subtl/subtl.py", line 45, in __init__
    self.peer_id = self._generate_peer_id()
  File "./src/lib/subtl/subtl.py", line 210, in _generate_peer_id
    numbers = [str(random.randint(0, 9)) for _ in xrange(remaining)]
NameError: name 'xrange' is not defined
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/gevent/greenlet.py", line 534, in run
    result = self._run(*self.args, **self.kwargs)
  File "./src/Plugin/../../plugins/AnnounceZero/AnnounceZeroPlugin.py", line 43, in announceTracker
    tracker_protocol, tracker_address, fileserver_port, add_types, my_peer_id, mode
  File "./src/Site/Site.py", line 679, in announceTracker
    tracker = UdpTrackerClient(ip, int(port))
  File "./src/lib/subtl/subtl.py", line 45, in __init__
    self.peer_id = self._generate_peer_id()
  File "./src/lib/subtl/subtl.py", line 210, in _generate_peer_id
    numbers = [str(random.randint(0, 9)) for _ in xrange(remaining)]
NameError: name 'xrange' is not defined
[01:38:03] - Unhandled exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/gevent/greenlet.py", line 534, in run
    result = self._run(*self.args, **self.kwargs)
  File "./src/Plugin/../../plugins/AnnounceZero/AnnounceZeroPlugin.py", line 43, in announceTracker
    tracker_protocol, tracker_address, fileserver_port, add_types, my_peer_id, mode
  File "./src/Site/Site.py", line 679, in announceTracker
    tracker = UdpTrackerClient(ip, int(port))
  File "./src/lib/subtl/subtl.py", line 45, in __init__
    self.peer_id = self._generate_peer_id()
  File "./src/lib/subtl/subtl.py", line 210, in _generate_peer_id
    numbers = [str(random.randint(0, 9)) for _ in xrange(remaining)]
NameError: name 'xrange' is not defined
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/gevent/greenlet.py", line 534, in run
    result = self._run(*self.args, **self.kwargs)
  File "./src/Plugin/../../plugins/AnnounceZero/AnnounceZeroPlugin.py", line 43, in announceTracker
    tracker_protocol, tracker_address, fileserver_port, add_types, my_peer_id, mode
  File "./src/Site/Site.py", line 679, in announceTracker
    tracker = UdpTrackerClient(ip, int(port))
  File "./src/lib/subtl/subtl.py", line 45, in __init__
    self.peer_id = self._generate_peer_id()
  File "./src/lib/subtl/subtl.py", line 210, in _generate_peer_id
    numbers = [str(random.randint(0, 9)) for _ in xrange(remaining)]
NameError: name 'xrange' is not defined
[01:38:03] - Unhandled exception
Traceback (most recent call last):
  File "./src/Site/Site.py", line 699, in announceTracker
    url = "http://" + tracker_address + "?" + urllib.urlencode(params)
AttributeError: module 'urllib' has no attribute 'urlencode'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/gevent/greenlet.py", line 534, in run
    result = self._run(*self.args, **self.kwargs)
  File "./src/Plugin/../../plugins/AnnounceZero/AnnounceZeroPlugin.py", line 43, in announceTracker
    tracker_protocol, tracker_address, fileserver_port, add_types, my_peer_id, mode
  File "./src/Site/Site.py", line 721, in announceTracker
    self.log.debug("Http tracker %s error: %s" % (url, err))
UnboundLocalError: local variable 'url' referenced before assignment
Traceback (most recent call last):
  File "./src/Site/Site.py", line 699, in announceTracker
    url = "http://" + tracker_address + "?" + urllib.urlencode(params)
AttributeError: module 'urllib' has no attribute 'urlencode'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/gevent/greenlet.py", line 534, in run
    result = self._run(*self.args, **self.kwargs)
  File "./src/Plugin/../../plugins/AnnounceZero/AnnounceZeroPlugin.py", line 43, in announceTracker
    tracker_protocol, tracker_address, fileserver_port, add_types, my_peer_id, mode
  File "./src/Site/Site.py", line 721, in announceTracker
    self.log.debug("Http tracker %s error: %s" % (url, err))
UnboundLocalError: local variable 'url' referenced before assignment
[01:38:03] - Unhandled exception
Traceback (most recent call last):
  File "./src/Site/Site.py", line 699, in announceTracker
    url = "http://" + tracker_address + "?" + urllib.urlencode(params)
AttributeError: module 'urllib' has no attribute 'urlencode'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/gevent/greenlet.py", line 534, in run
    result = self._run(*self.args, **self.kwargs)
  File "./src/Plugin/../../plugins/AnnounceZero/AnnounceZeroPlugin.py", line 43, in announceTracker
    tracker_protocol, tracker_address, fileserver_port, add_types, my_peer_id, mode
  File "./src/Site/Site.py", line 721, in announceTracker
    self.log.debug("Http tracker %s error: %s" % (url, err))
UnboundLocalError: local variable 'url' referenced before assignment
Traceback (most recent call last):
  File "./src/Site/Site.py", line 699, in announceTracker
    url = "http://" + tracker_address + "?" + urllib.urlencode(params)
AttributeError: module 'urllib' has no attribute 'urlencode'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/gevent/greenlet.py", line 534, in run
    result = self._run(*self.args, **self.kwargs)
  File "./src/Plugin/../../plugins/AnnounceZero/AnnounceZeroPlugin.py", line 43, in announceTracker
    tracker_protocol, tracker_address, fileserver_port, add_types, my_peer_id, mode
  File "./src/Site/Site.py", line 721, in announceTracker
    self.log.debug("Http tracker %s error: %s" % (url, err))
UnboundLocalError: local variable 'url' referenced before assignment
[01:38:03] - Unhandled exception
Traceback (most recent call last):
  File "./src/Site/Site.py", line 699, in announceTracker
    url = "http://" + tracker_address + "?" + urllib.urlencode(params)
AttributeError: module 'urllib' has no attribute 'urlencode'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/gevent/greenlet.py", line 534, in run
    result = self._run(*self.args, **self.kwargs)
  File "./src/Plugin/../../plugins/AnnounceZero/AnnounceZeroPlugin.py", line 43, in announceTracker
    tracker_protocol, tracker_address, fileserver_port, add_types, my_peer_id, mode
  File "./src/Site/Site.py", line 721, in announceTracker
    self.log.debug("Http tracker %s error: %s" % (url, err))
UnboundLocalError: local variable 'url' referenced before assignment
Traceback (most recent call last):
  File "./src/Site/Site.py", line 699, in announceTracker
    url = "http://" + tracker_address + "?" + urllib.urlencode(params)
AttributeError: module 'urllib' has no attribute 'urlencode'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/gevent/greenlet.py", line 534, in run
    result = self._run(*self.args, **self.kwargs)
  File "./src/Plugin/../../plugins/AnnounceZero/AnnounceZeroPlugin.py", line 43, in announceTracker
    tracker_protocol, tracker_address, fileserver_port, add_types, my_peer_id, mode
  File "./src/Site/Site.py", line 721, in announceTracker
    self.log.debug("Http tracker %s error: %s" % (url, err))
UnboundLocalError: local variable 'url' referenced before assignment
[01:38:03] Site:1Name2..hM9F Announce to 0 trackers in 0.016s, failed
[01:38:03] Site:1Name2..hM9F Content.json not exist: data/1Name2NXVi1RDPDgf5617UoW7xA6YrhM9F/content.json
[01:38:03] - Unhandled exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/gevent/greenlet.py", line 534, in run
    result = self._run(*self.args, **self.kwargs)
  File "./src/Site/Site.py", line 338, in update
    for bad_file in self.bad_files.keys():
RuntimeError: dictionary changed size during iteration
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/gevent/greenlet.py", line 534, in run
    result = self._run(*self.args, **self.kwargs)
  File "./src/Site/Site.py", line 338, in update
    for bad_file in self.bad_files.keys():
RuntimeError: dictionary changed size during iteration
[01:38:04] FileServer Checking port 15441 using portchecker.co...
[01:38:04] FileServer [BAD :(] Port closed: Error: TypeError: POST data should be bytes or an iterable of bytes. It cannot be of type str. in FileServer.py line 100 > request.py line 163 > request.py line 464 > request.py line 1183
[01:38:04] FileServer Trying to open port using UpnpPunch...
[01:38:04] FileServer UpnpPunch run error: TypeError: a bytes-like object is required, not 'str' in FileServer.py line 75 > UpnpPunch.py line 219 > UpnpPunch.py line 49 > _socket3.py line 410
[01:38:04] FileServer Upnp mapping failed :( Please forward port 15441 on your router to your ipaddress
^C[01:38:07] - Unhandled exception
NoneType
TypeError: print_exception(): Exception expected for value, NoneType found

La primera vez que lei al respecto, me parecio una idea estupenda... BitTorrent en Zeronet. Reconozco haber sido muy, pero muy ingenuo. ¿Que se esconde detras de esta idea?.



Parte del codigo de ZeroNet es tambien codigo del protocolo BitTorrent... no recuerdo exactamente cual, pero creo que es DHT, o mas bien dicho, aquel que ayuda a compartir los datos.


El codigo de Bitcoin asegura que los datos que recibimos todos sea el mismo y el de BitTorrent asume el trabajo de compartir los datos.


Bajo esta premisa, pense que ya alguien habia conseguido crear una adaptacion de BitTorrent que nos permitiera compartir archivos sobre la propia Red Zeronet... pero no fue asi y probablemente nunca sera asi, en el corto plazo.


La realidad fue mas cruel: La idea fue aun mas simple y menos creativa, es decir, reemplazar a los sitios que alojan los enlaces magneticos.


Al parecer nadie quiere abrir los ojos, ni quiere escuchar lo obvio: Aunque aparentemente todavia no nos halla llegado ninguna carta judicial o policial, por estar infringiendo tal o cual ley, al descargar archivos via P2P, esto no implica que las agencias policiales no esten guardando y espiando nuestros movimientos. Y al descargar un archivo a traves de la red P2P abierta, y que contenga contenidos con Licencias Restrictivas y Comerciales, estaremos activando de forma automatica el interes hacia nuestra maquina...


Alguien se ha preguntado ¿por que los medios de comunicacion solo se preocupan de Tor e ignoran o invisibilizan a proposito a Freenet y I2P?


La razon es bastante transparente: Solo Freenet y I2P permiten el intercambio de archivos via P2P de manera 100% anonima.


Mientras la policia no consiga alguna herramienta efectiva para poder controlar los movimientos de los usuarios de esas darknets, los medios seguiran amordazados y no informaran de la verdad.


Yo no descargo nada desde el BitTorrent abierto, a excepcion de alguna distribucion Linux, o poco mas que eso de vez en cuando. BitTorrent es un protocolo muy popular, que se usa en varios ambitos y no solo para compartir archivos ilegales... como muchos pensaran. De hecho, es probable que la mayor parte del trafico P2P sea a causa de los servicios de TV via internet.


This post have two images, most probably yo will not be able to see them, because you need to have the Interplanetary File System installed.

IPFS is quite simple to install and run: Download, Untar and Run https://ipfs.io/docs/install/

But you can use the site ipfs.pics as an alternative!

Once you have IPFS running embedding images on ZeroNet is quite simple, just add it to your filesistem using, for instance, the web interface http://localhost:5001/ipfs/ and you will get a key, for instance QmPxRuBbMVzFBQocEd3D6dYE2D9r5YJM7QSRKapwGtmtkA, then on your ZeroBlog you could use the following code: ![Caption](http://localhost:8080/ipfs/QmPxRuBbMVzFBQocEd3D6dYE2D9r5YJM7QSRKapwGtmtkA), but this will not work if you are accessing from a mobile phone or someone don't have IPFS installed, so is better to use a Gateway, for instance: ![Caption](https://gateway.ipfs.io/ipfs/QmPxRuBbMVzFBQocEd3D6dYE2D9r5YJM7QSRKapwGtmtkA) (you don't need to upload your file to gateway.ipfs.io, remember, is P2P). You can install an Addon like IPFS Gateway Redirect to your browser to redirect the gateway to your local instance.

For the alternative link the code should be [Alternative site](https://ipfs.pics/QmPxRuBbMVzFBQocEd3D6dYE2D9r5YJM7QSRKapwGtmtkA)

This code also works on comments!

Sexy woman 01

Hamilton01 Alternative site

Sexy woman 02

Hamilton02 Alternative site

Проблемы переноса

- Posted in __br☣m__.py by with comments

Новые проблемы! Надо править еще кучу кода в плагинах, но это не беда. Беда в том, что главное отличие второго и третьего питона это кодировка строк. Во втором питоне все строки байтовые, а вот в третьем они по умолчанию в юникоде... Из-за этого нужно явно указать что строки байтовые, для всех строк участвующих в POST запросах.

Python 3

- Posted in __br☣m__.py by with comments

В данный момент занимаюсь портированием клиента ZeroNet со второго питона на третий. Все ~~изменения~~ ошибки, на данный момент, относятся к одному из трех типов: 1) print без скобок ( но это типично); 2) except Exception, err вместо except Exception as err; 3) Ошибки видимости модулей, решаемая с помощью:

import sys,os
sys.path.append(os.path.join(os.path.dirname(__file__)))

Кроме всего, в третьем питоне нет типа file, по этому приходится использовать конструкцию:

from io import IOBase
class FilePart(IOBase):

вместо:

class FilePart(file):

А тут написано про переименование атрибутов функций

Кроме того, столкнулся с ошибкой:

AttributeError: 'dict' object has no attribute 'iteritems'

в третьем питоне используется метод items() вместо iteritems()

Оформление

- Posted in __br☣m__.py by with comments

Немного похимичил с оформлением блога. Если кому интересно ( и если это не локальное отображение блога), то все правки вносятся в файлик css/all.css ( в папке вашего блога), но применяются почему-то не сразу.