Автор Тема: Blender, трояны и другие скрипты  (Прочитано 13044 раз)

Оффлайн sungreen

  • ...
  • Житель
  • Kostroma mon amour
    • sungreen.github.io
Blender, трояны и другие скрипты
« : 10 Сентябрь 2010, 07:24:58 »
... паранойя,  но оно посещает регулярно - ведь питон дает достаточно возможности навставлять всякого такого, а вот когда появятся вирусы под блендер? ...
... конечно, обычно мыж не запускаем скрипты из инета, это опасно, но качаем всякие тулзы и сборки блендера и запускаем их, а кто-то даже от рута ...
... Друзья, или это не так и под блендер невозможно существование ни каких вирусов ибо блендер он белый и пушистый? ...

ps навеяно вот этим, как всегда начинается с малого
http://www.kaspersky.ru/news?id=207733291
http://www.kaspersky.ru/news?id=207733309
« Последнее редактирование: 05 Ноябрь 2011, 23:47:15 от sungreen »
Для Кота

Оффлайн nort

  • Житель
  • интерьеры
Re: Blender, трояны и другие вирусы
« Ответ #1 : 10 Сентябрь 2010, 09:19:48 »
тоже есть параноя.но я думаю блендеру ще далеко до этого.тем более мне это не гразит,я качаю с оф сайта.
Blender25/V-Ray.Ученые пытаются каждый предмет изучения разложить на атомы, и человечество послушно распадается на атомы.

Оффлайн Юрий Пет

  • Администратор
  • Житель
Re: Blender, трояны и другие вирусы
« Ответ #2 : 10 Сентябрь 2010, 11:05:58 »
А у меня нет никакой паранойи, даже не думаю об этом, зачем голову забивать
А вообще ставьте антивирусы
Поиск по сайту, это круто

Оффлайн sungreen

  • ...
  • Житель
  • Kostroma mon amour
    • sungreen.github.io
Re: Blender, трояны и другие скрипты
« Ответ #3 : 05 Ноябрь 2011, 23:50:06 »
... вот попробовал накинуть скрипт для blender 2.6 для экспорта в engrid ...
io_export_engrid.py

Код: python
# ##### BEGIN GPL LICENSE BLOCK #####
#
#  This program is free software; you can redistribute it and/or
#  modify it under the terms of the GNU General Public License
#  as published by the Free Software Foundation; either version 2
#  of the License, or (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software Foundation,
#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####

bl_info = {
    "name": "Export Engrid (.begc)",
    "author": "test",
    "version": (0, 1),
    "blender": (2, 6, 0),
    "api": 36079,
    "location": "File > Export > Engrid (.begc)",
    "description": "Export mesh Engrid data (.begc)",
    "warning": "",
    "wiki_url": "",
    "tracker_url": "",
    "category": "Import-Export"}

'''
Usage Notes:


'''

import bpy
from bpy.props import *
import mathutils, math, struct
from os import remove
import time
from bpy_extras.io_utils import ExportHelper


def do_export(context, props, filepath):
    out = open(filepath, "w")
    out.write('%d\n' % len(bpy.data.meshes))
    node_offset = 0
   
    for mesh in bpy.data.meshes:
        out.write(mesh.name)
        out.write('\n')
   
    for mesh in bpy.data.meshes:
        faces = mesh.faces
        nodes = mesh.vertices
        out.write('%d' % len(nodes))
        out.write(' %d\n' % len(faces))
        for n in nodes:
            out.write("%e " % n.co[0])
            out.write("%e " % n.co[1])
            out.write("%e\n" % n.co[2])
        for f in faces:
            out.write("%d" % len(f.vertices))
            for v in f.vertices:
                out.write(' %d' % (v + node_offset))
            out.write('\n')
        node_offset = node_offset + len(nodes)
   
    out.flush()
    out.close()
    return True


###### EXPORT OPERATOR #######
class Export_engrid(bpy.types.Operator, ExportHelper):
    bl_idname = "export_shape.engrid"
    bl_label = "Export Engrid (.begc)"
    filename_ext = ".begc"
   

   
    @classmethod
    def poll(cls, context):
        return context.active_object.type in {'MESH', 'CURVE', 'SURFACE', 'FONT'}

    def execute(self, context):
        start_time = time.time()
        print('\n_____START_____')
        props = self.properties
        filepath = self.filepath
        filepath = bpy.path.ensure_ext(filepath, self.filename_ext)

        exported = do_export(context, props, filepath)
       
        if exported:
            print('finished export in %s seconds' %((time.time() - start_time)))
            print(filepath)
           
        return {'FINISHED'}

    def invoke(self, context, event):
        wm = context.window_manager

        if True:
            # File selector
            wm.fileselect_add(self) # will run self.execute()
            return {'RUNNING_MODAL'}
        elif True:
            # search the enum
            wm.invoke_search_popup(self)
            return {'RUNNING_MODAL'}
        elif False:
            # Redo popup
            return wm.invoke_props_popup(self, event)
        elif False:
            return self.execute(context)


### REGISTER ###

def menu_func(self, context):
    self.layout.operator(Export_engrid.bl_idname, text="Engrid (.begc)")


def register():
    bpy.utils.register_module(__name__)
    bpy.types.INFO_MT_file_export.append(menu_func)

def unregister():
    bpy.utils.unregister_module(__name__)
    bpy.types.INFO_MT_file_export.remove(menu_func)
   
if __name__ == "__main__":
    register()

[вложение удалено Администратором]
« Последнее редактирование: 06 Ноябрь 2011, 10:18:08 от sungreen »
Для Кота

Оффлайн sungreen

  • ...
  • Житель
  • Kostroma mon amour
    • sungreen.github.io
Re: Blender, трояны и другие скрипты
« Ответ #4 : 07 Ноябрь 2011, 22:40:49 »
... Oliver поправил скрипт и теперь его модификация лежит по ссылке ...
http://db.tt/HUJynYkQ

... Само обсуждение можно посмотреть ...
http://engits.eu/vanilla/index.php?p=/discussion/96/installing-the-importexport-scripts-for-blender/#Item_14

Код: python
# ##### BEGIN GPL LICENSE BLOCK #####
#
#  This program is free software; you can redistribute it and/or
#  modify it under the terms of the GNU General Public License
#  as published by the Free Software Foundation; either version 2
#  of the License, or (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software Foundation,
#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####

bl_info = {
    "name": "Export to enGrid (.begc)",
    "author": "Unknown Author",
    "version": (0, 1),
    "blender": (2, 5, 9),
    "api": 36079,
    "location": "File > Export > enGrid (.begc)",
    "description": "Export objects as boundaries to enGrid's Blender exchange format (*.begc)",
    "warning": "",
    "wiki_url": "http://engits.eu/wiki",
    "tracker_url": "http://sourceforge.net/apps/mantisbt/engrid",
    "category": "Import-Export"}

'''
Usage Notes:
'''

import bpy
from bpy.props import *
import mathutils, math, struct
from os import remove
import time
from bpy_extras.io_utils import ExportHelper


def do_export(context, props, filepath):
    out = open(filepath, "w")
    out.write('%d\n' % len(bpy.data.meshes))
    node_offset = 0   
   
    for obj in bpy.data.objects:
        if obj.type == 'MESH':
            out.write(obj.name)
            out.write('\n')   
   
    for obj in bpy.data.objects:
        if obj.type == 'MESH':
            mesh = obj.data
            mesh.transform(obj.matrix_world)
            faces = mesh.faces
            nodes = mesh.vertices
            out.write('%d' % len(nodes))
            out.write(' %d\n' % len(faces))
            for n in nodes:
                out.write("%e " % n.co[0])
                out.write("%e " % n.co[1])
                out.write("%e\n" % n.co[2])
            for f in faces:
                out.write("%d" % len(f.vertices))
                for v in f.vertices:
                    out.write(' %d' % (v + node_offset))
                out.write('\n')
            node_offset = node_offset + len(nodes)
   
    out.flush()
    out.close()
    return True


###### EXPORT OPERATOR #######
class Export_engrid(bpy.types.Operator, ExportHelper):
    bl_idname = "export_shape.engrid"
    bl_label = "Export enGrid (.begc)"
    filename_ext = ".begc"
   

   
    @classmethod
    def poll(cls, context):
        return context.active_object.type in {'MESH', 'CURVE', 'SURFACE', 'FONT'}

    def execute(self, context):
        start_time = time.time()
        print('\n_____START_____')
        props = self.properties
        filepath = self.filepath
        filepath = bpy.path.ensure_ext(filepath, self.filename_ext)

        exported = do_export(context, props, filepath)
       
        if exported:
            print('finished export in %s seconds' %((time.time() - start_time)))
            print(filepath)
           
        return {'FINISHED'}

    def invoke(self, context, event):
        wm = context.window_manager

        if True:
            # File selector
            wm.fileselect_add(self) # will run self.execute()
            return {'RUNNING_MODAL'}
        elif True:
            # search the enum
            wm.invoke_search_popup(self)
            return {'RUNNING_MODAL'}
        elif False:
            # Redo popup
            return wm.invoke_props_popup(self, event)
        elif False:
            return self.execute(context)


### REGISTER ###

def menu_func(self, context):
    self.layout.operator(Export_engrid.bl_idname, text="enGrid (.begc)")


def register():
    bpy.utils.register_module(__name__)
    bpy.types.INFO_MT_file_export.append(menu_func)

def unregister():
    bpy.utils.unregister_module(__name__)
    bpy.types.INFO_MT_file_export.remove(menu_func)
   
if __name__ == "__main__":
    register()
« Последнее редактирование: 07 Ноябрь 2011, 22:43:18 от sungreen »
Для Кота

Оффлайн sungreen

  • ...
  • Житель
  • Kostroma mon amour
    • sungreen.github.io
Re: Blender, трояны и другие скрипты
« Ответ #5 : 10 Ноябрь 2011, 18:45:09 »
... добавил новый функционал в скрипт экспорта в enGrid ...
... мне показалось очень полезным возможность экспорта с учетом модификаторов, в примере модификатор сглаживания ...

[вложение удалено Администратором]
Для Кота

Оффлайн sungreen

  • ...
  • Житель
  • Kostroma mon amour
    • sungreen.github.io
Re: Blender, трояны и другие скрипты
« Ответ #6 : 10 Ноябрь 2011, 18:47:55 »
... вот сам скрипт export enGrid for Blender 2.5.9 and blender 2.6.x ...
Добавлено:
Rotate 90 degrees around X to convert to y-up,
Transform the Vertexcoordinates into Worldspace,
Applies the Modifiers.
Код: python
# ##### BEGIN GPL LICENSE BLOCK #####
#
#  This program is free software; you can redistribute it and/or
#  modify it under the terms of the GNU General Public License
#  as published by the Free Software Foundation; either version 2
#  of the License, or (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software Foundation,
#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####

bl_info = {
"name": "Export to enGrid (.begc)",
"author": "Unknown Author",
"version": (0, 2),
"blender": (2, 5, 9),
"api": 36079,
"location": "File > Export > enGrid (.begc)",
"description": "Export objects as boundaries to enGrid's Blender exchange format (*.begc)",
"warning": "",
"wiki_url": "http://engits.eu/wiki",
"tracker_url": "http://sourceforge.net/apps/mantisbt/engrid",
"category": "Import-Export"}

'''
Usage Notes:
'''

import bpy
from bpy.props import *
import mathutils, math, struct
from os import remove
import time
from bpy_extras.io_utils import ExportHelper


def do_export(context, props, filepath):
mat_x90 = mathutils.Matrix.Rotation(-math.pi/2, 4, 'X')

obmnames=""
obmcount=0
for obj in bpy.data.objects:
if obj.type == 'MESH':
obmcount+=1
obmnames+=obj.name+'\n'

if obmcount!=0:
node_offset = 0
out = open(filepath, "w")
out.write('%d' % obmcount)
out.write('\n')
out.write(obmnames)

for obj in bpy.data.objects:
if obj.type == 'MESH':
mesh = obj.to_mesh(context.scene, props.apply_modifiers, 'PREVIEW')
if props.world_space:
mesh.transform(obj.matrix_world)
if props.rot_x90:
mesh.transform(mat_x90)
faces = mesh.faces
nodes = mesh.vertices
out.write('%d' % len(nodes))
out.write(' %d\n' % len(faces))
for n in nodes:
out.write("%e " % n.co[0])
out.write("%e " % n.co[1])
out.write("%e\n" % n.co[2])
for f in faces:
out.write("%d" % len(f.vertices))
for v in f.vertices:
out.write(' %d' % (v + node_offset))
out.write('\n')
node_offset = node_offset + len(nodes)
out.flush()
out.close()
return True


###### EXPORT OPERATOR #######
class Export_engrid(bpy.types.Operator, ExportHelper):
bl_idname = "export_shape.engrid"
bl_label = "Export enGrid (.begc)"
filepath = "untitled"
filename_ext = ".begc"


rot_x90 = BoolProperty(name="Convert to Y-up",
description="Rotate 90 degrees around X to convert to y-up",
default=False,
)
world_space = BoolProperty(name="Export into Worldspace",
description="Transform the Vertexcoordinates into Worldspace",
default=True,
)
apply_modifiers = BoolProperty(name="Apply Modifiers",
description="Applies the Modifiers",
default=True,
)

@classmethod
def poll(cls, context):
return context.active_object.type in {'MESH', 'CURVE', 'SURFACE', 'FONT'}

def execute(self, context):
start_time = time.time()
print('\n_____START_____')
print(self.filepath)
props = self.properties
filepath = self.filepath
filepath = bpy.path.ensure_ext(filepath, self.filename_ext)
print(self.filepath)
exported = do_export(context, props, filepath)

if exported:
print('finished export in %s seconds' %((time.time() - start_time)))
print(filepath)

return {'FINISHED'}

def invoke(self, context, event):
wm = context.window_manager

if True:
# File selector
wm.fileselect_add(self) # will run self.execute()
return {'RUNNING_MODAL'}
elif True:
# search the enum
wm.invoke_search_popup(self)
return {'RUNNING_MODAL'}
elif False:
# Redo popup
return wm.invoke_props_popup(self, event)
elif False:
return self.execute(context)


### REGISTER ###

def menu_func(self, context):
self.layout.operator(Export_engrid.bl_idname, text="enGrid (.begc)")


def register():
bpy.utils.register_module(__name__)
bpy.types.INFO_MT_file_export.append(menu_func)

def unregister():
bpy.utils.unregister_module(__name__)
bpy.types.INFO_MT_file_export.remove(menu_func)

if __name__ == "__main__":
register()

... жаль что форум не поддерживает подсветку синтаксиса ...



[вложение удалено Администратором]
« Последнее редактирование: 15 Ноябрь 2011, 19:47:34 от sungreen »
Для Кота

Оффлайн sungreen

  • ...
  • Житель
  • Kostroma mon amour
    • sungreen.github.io
Re: Blender, трояны и другие скрипты
« Ответ #7 : 12 Ноябрь 2011, 08:01:35 »
Для сравнения размещу здесь скрипт export enGrid for Blender 2.49


Код: python
#!BPY
#
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# +                                                                      +
# + This file is part of enGrid.                                         +
# +                                                                      +
# + Copyright 2008-2010 enGits GmbH                                     +
# +                                                                      +
# + enGrid is free software: you can redistribute it and/or modify       +
# + it under the terms of the GNU General Public License as published by +
# + the Free Software Foundation, either version 3 of the License, or    +
# + (at your option) any later version.                                  +
# +                                                                      +
# + enGrid is distributed in the hope that it will be useful,            +
# + but WITHOUT ANY WARRANTY; without even the implied warranty of       +
# + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        +
# + GNU General Public License for more details.                         +
# +                                                                      +
# + You should have received a copy of the GNU General Public License    +
# + along with enGrid. If not, see <http://www.gnu.org/licenses/>.       +
# +                                                                      +
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#

"""
Name: 'Engrid (*.begc)'
Blender: 249
Group: 'Export'
Tooltip: 'Export to Engrid'
"""

import Blender
import bpy

def write(filename):
 
  Blender.Window.WaitCursor(1)
 
  if not filename.lower().endswith('.begc'):
    filename += '.begc'
  out = file(filename, "w")
  objects = Blender.Object.GetSelected()
 
  num_objects = 0
  for object in objects:
    if object.type == 'Mesh':
      num_objects = num_objects + 1
     
  out.write('%d\n' % num_objects)
  node_offset = 0
  for object in objects:
    if object.type == 'Mesh':
      out.write(object.name)
      out.write('\n')
  for object in objects:
    if object.type == 'Mesh':
      mesh  = object.getData(0,1)
      faces = mesh.faces
      nodes = mesh.verts
      out.write('%d' % len(nodes))
      out.write(' %d\n' % len(faces))
      for n in nodes:
        out.write("%e " % n.co[0])
        out.write("%e " % n.co[1])
        out.write("%e\n" % n.co[2])
      for f in faces:
        N = len(f.verts)
        if N < 3 and N > 4:
          Blender.Draw.PupMenu('Error%t|Only triangles and quads allowed')
          return
        out.write("%d" % N)
        for v in f.verts:
          out.write(' %d' % (v.index + node_offset))
        out.write('\n')
      node_offset = node_offset + len(nodes)

  Blender.Window.WaitCursor(0)

Blender.Window.FileSelector(write, "Export", Blender.sys.makename(ext='.begc'))

[вложение удалено Администратором]
« Последнее редактирование: 12 Ноябрь 2011, 08:05:05 от sungreen »
Для Кота

Оффлайн sungreen

  • ...
  • Житель
  • Kostroma mon amour
    • sungreen.github.io
Re: Blender, трояны и другие скрипты
« Ответ #8 : 30 Декабрь 2011, 23:40:35 »
... переписал скрипт для импорта данных OpenStreetMap for Blender ...
... разделил скрипт на две части, первая часть предназначена для загрузки данных из XML ...
... вторая часть будет генерить локации, здания, сооружения и т.д. по уже загруженным данным ...

... вот первый тестовый скрипт для импорта (без генерации локаций) ...
... надеюсь скоро доработать вторую часть генерация локаций по карте ...

Код: python

import bpy
import math
import xml.dom.minidom
from xml.dom.minidom import Node


def parse_osm(filename):
    doc = xml.dom.minidom.parse(filename)

    lon_min = 180.0
    lon_max = 0.0

    lat_min = 180.0
    lat_max = 0.0
   
    for node  in doc.getElementsByTagName("node"):
        lon = float(node.getAttribute("lon"))
        lat = float(node.getAttribute("lat"))
        if lon_min>lon:
            lon_min=lon
        if lon_max<lon:
            lon_max=lon
        if lat_min>lat:
            lat_min=lat
        if lat_max<lat:
            lat_max=lat
       
    lon_c=(lon_max+lon_min)/2
    lat_c=(lat_max+lat_min)/2
    r=6378245.0
    l=math.pi*r/2
       
    nodes={}
    for node  in doc.getElementsByTagName("node"):
        id = str(node.getAttribute("id"))
        lon = float(node.getAttribute("lon"))
        lat = float(node.getAttribute("lat"))
        lonm = lon-lon_c   
        n = l*(lat-lat_c)/90
        e = l*math.cos(math.radians(lat))*(lon-lon_c)/90
        nodes[id]=(e,n,0)

    for way in doc.getElementsByTagName("way"):
        id=way.getAttribute("id")
        bpy.ops.curve.primitive_nurbs_path_add()
        curve = bpy.context.object
        curve.name="id"+id
       
        bpy.ops.object.editmode_toggle()
        bpy.ops.curve.delete(type='ALL')

        for tag in way.getElementsByTagName("tag"):
            k = tag.getAttribute("k")
            v = tag.getAttribute("v")
            curve[k]=v

        for noderef in way.getElementsByTagName("nd"):
            ref = noderef.getAttribute("ref")
            nd = nodes[ref]
            bpy.ops.curve.vertex_add(location=nd)

        bpy.ops.curve.select_all(action='SELECT')
        bpy.ops.curve.handle_type_set(type='VECTOR')
        bpy.ops.object.editmode_toggle()
   
def main():
    filename = '... insert name xml datafile ...'
    parse_osm(filename)

main()



[вложение удалено Администратором]
« Последнее редактирование: 31 Декабрь 2011, 00:05:11 от sungreen »
Для Кота

Оффлайн sungreen

  • ...
  • Житель
  • Kostroma mon amour
    • sungreen.github.io
Re: Blender, трояны и другие скрипты
« Ответ #9 : 05 Сентябрь 2012, 20:25:00 »
... прочитал сегодня в сообщение группы расссылки [bf-blender-Blender 2.6 Bug Tracker][22509] possible symlink attack in blender 2.5 ...
... обеспокоенность автора сообщения вызывает тот факт, что Blender сохраняет файл quit.blend в общедоступной tmp директории ...
... автор также предполагает, что злоумышлинник может получить несанкционированный достук этому файлу, подменить его содержание и тем самым destroying whatever data was in the file in the process ...

... возможно это паранойя, но разработчики Blender признают наличие других более серьезных проблемах безопасности Blender so it's not really a bug (there are many more 'security' issues in blender than this) ...
Для Кота

Оффлайн sungreen

  • ...
  • Житель
  • Kostroma mon amour
    • sungreen.github.io
Re: Blender, трояны и другие скрипты
« Ответ #10 : 20 Июль 2013, 16:26:08 »
... порадовала новость в анотации к версии 2.68 "С целью повышения безопасности при загрузке .blend-файлов по умолчанию отключен автоматический запуск скриптов и драйверов на языке Python (отключенная особенность могла использоваться злоумышленниками для организации выполнения python-кода при открытии файлов из непроверенных источников);" ...
... наконец-то очевидное стало наглядным http://blender-3d.ru/forum/index.php/topic,126.msg2179.html#msg2179 , а три года назад в этой теме никто серьезно к этому не отнёсся ...
... так что паранойя рулез ...
« Последнее редактирование: 21 Июль 2013, 06:32:53 от sungreen »
Для Кота

 


Яметрика

* По форуму

* Рекламный блок

* Последние вложения

1 (1).png
Скачано: 68
Автор: LEXA ANЭGROWND
blender.png
Скачано: 78
Автор: ipv2007
4.png
Скачано: 100
Автор: hiroyukiss
2.png
Скачано: 122
Автор: hiroyukiss

Скачано: 112
Автор: Dilifa12