{"action":"created","issue":{"url":"https://api.github.com/repos/cuckoosandbox/cuckoo/issues/2254","repository_url":"https://api.github.com/repos/cuckoosandbox/cuckoo","labels_url":"https://api.github.com/repos/cuckoosandbox/cuckoo/issues/2254/labels{/name}","comments_url":"https://api.github.com/repos/cuckoosandbox/cuckoo/issues/2254/comments","events_url":"https://api.github.com/repos/cuckoosandbox/cuckoo/issues/2254/events","html_url":"https://github.com/cuckoosandbox/cuckoo/issues/2254","id":319172503,"number":2254,"title":"submit files with python error","user":{"login":"h0rs3fa11","id":27891578,"avatar_url":"https://avatars3.githubusercontent.com/u/27891578?v=4","gravatar_id":"","url":"https://api.github.com/users/h0rs3fa11","html_url":"https://github.com/h0rs3fa11","followers_url":"https://api.github.com/users/h0rs3fa11/followers","following_url":"https://api.github.com/users/h0rs3fa11/following{/other_user}","gists_url":"https://api.github.com/users/h0rs3fa11/gists{/gist_id}","starred_url":"https://api.github.com/users/h0rs3fa11/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/h0rs3fa11/subscriptions","organizations_url":"https://api.github.com/users/h0rs3fa11/orgs","repos_url":"https://api.github.com/users/h0rs3fa11/repos","events_url":"https://api.github.com/users/h0rs3fa11/events{/privacy}","received_events_url":"https://api.github.com/users/h0rs3fa11/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-05-01T11:07:00Z","updated_at":"2018-05-02T14:03:49Z","closed_at":null,"author_association":"NONE","body":"\r\n##### My issue is:\r\nI use cuckoo document(submit an analysis ->python function),the code is:\r\n```python\r\nfrom cuckoo.core.database import Database\r\ndb = Database()\r\ndb.add_path(\"/tmp/malware.exe\")\r\n```\r\nand I got error:\r\n```\r\nTraceback (most recent call last):\r\n  File \"submit_cuckoo.py\", line 8, in submit\r\n    task_id = db.add_path(SAMPLE_FILE)\r\n  File \"/usr/local/lib/python2.7/dist-packages/cuckoo/core/database.py\", line 1105, in add_path\r\n    enforce_timeout, clock, \"file\", submit_id)\r\n  File \"/usr/local/lib/python2.7/dist-packages/cuckoo/common/utils.py\", line 196, in inner\r\n    return f(self, *args, **kwargs)\r\n  File \"/usr/local/lib/python2.7/dist-packages/cuckoo/core/database.py\", line 981, in add\r\n    session = self.Session()\r\nAttributeError: 'Database' object has no attribute 'Session'\r\n```\r\nWhy?How to solve this?\r\n##### My Cuckoo version and operating system are:\r\n2.0.5 and Ubuntu 17.04"},"comment":{"url":"https://api.github.com/repos/cuckoosandbox/cuckoo/issues/comments/385988651","html_url":"https://github.com/cuckoosandbox/cuckoo/issues/2254#issuecomment-385988651","issue_url":"https://api.github.com/repos/cuckoosandbox/cuckoo/issues/2254","id":385988651,"user":{"login":"RicoVZ","id":8687431,"avatar_url":"https://avatars1.githubusercontent.com/u/8687431?v=4","gravatar_id":"","url":"https://api.github.com/users/RicoVZ","html_url":"https://github.com/RicoVZ","followers_url":"https://api.github.com/users/RicoVZ/followers","following_url":"https://api.github.com/users/RicoVZ/following{/other_user}","gists_url":"https://api.github.com/users/RicoVZ/gists{/gist_id}","starred_url":"https://api.github.com/users/RicoVZ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RicoVZ/subscriptions","organizations_url":"https://api.github.com/users/RicoVZ/orgs","repos_url":"https://api.github.com/users/RicoVZ/repos","events_url":"https://api.github.com/users/RicoVZ/events{/privacy}","received_events_url":"https://api.github.com/users/RicoVZ/received_events","type":"User","site_admin":false},"created_at":"2018-05-02T14:03:49Z","updated_at":"2018-05-02T14:03:49Z","author_association":"CONTRIBUTOR","body":"Ah, I misunderstood, if you are using the cuckoo libs outside of Cuckoo itself, you also have to specify what the $CWD is. This is were all Cuckoo configs and the database file is stored by default.\r\n\r\nThe cwd is located in your user home by default.\r\n\r\nTry this:\r\n\r\n```python\r\nfrom cuckoo.core.database import Database\r\nfrom cuckoo.misc import decide_cwd\r\n\r\ndecide_cwd(\"path to your cwd\")\r\ndb = Database()\r\ndb.connect()\r\ndb.add_path(\"/tmp/malware.exe\")\r\n```"}}
{"actor":{"display_login":"RicoVZ"}}