{"id":13509096,"url":"https://github.com/ramortegui/clamxir","last_synced_at":"2025-08-01T15:31:25.696Z","repository":{"id":41142818,"uuid":"145266949","full_name":"ramortegui/clamxir","owner":"ramortegui","description":"CalmAV wrapper for elixir","archived":false,"fork":false,"pushed_at":"2022-11-17T07:43:45.000Z","size":37,"stargazers_count":13,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-01T09:33:40.260Z","etag":null,"topics":["antivirus","clamav","clamdscan","clamscan","elixir","malware-detection","phoenix","phoenix-framework","security","security-scanner","security-tools","web"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ramortegui.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-08-19T02:25:36.000Z","updated_at":"2024-08-15T07:12:24.000Z","dependencies_parsed_at":"2023-01-21T07:47:09.684Z","dependency_job_id":null,"html_url":"https://github.com/ramortegui/clamxir","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ramortegui%2Fclamxir","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ramortegui%2Fclamxir/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ramortegui%2Fclamxir/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ramortegui%2Fclamxir/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ramortegui","download_url":"https://codeload.github.com/ramortegui/clamxir/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228389191,"owners_count":17912188,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["antivirus","clamav","clamdscan","clamscan","elixir","malware-detection","phoenix","phoenix-framework","security","security-scanner","security-tools","web"],"created_at":"2024-08-01T02:01:02.877Z","updated_at":"2024-12-06T00:07:35.083Z","avatar_url":"https://github.com/ramortegui.png","language":"Elixir","funding_links":[],"categories":["Security"],"sub_categories":[],"readme":"# Clamxir [![Build Status](https://travis-ci.org/ramortegui/clamxir.svg?branch=master)](https://travis-ci.org/ramortegui/clamxir)\n\nClamAV wrapper for elixir based on\n[clamby](https://github.com/kobaltz/clamby)\n\nThis package depends of clamav installed on your system. Please refer to: [https://www.clamav.net/documents/installing-clamav](https://www.clamav.net/documents/installing-clamav).\n\nAs recomendation, use the daemonize flag on the configs, in order to improve\nperformance.\n\n## Installation\n\nThe package can be installed by adding `clamxir` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:clamxir, \"~\u003e 0.1.8\"}\n  ]\nend\n```\n\n## Usage\n\nClamxir receive the configs on each public method, and based on the configs,\nwill perform their task.\n\nThe config file by default is the struct `%Clamxir{}`.  The default values of\nthe structure are:\n\n```elixir\n%Clamxir{\n  daemonize: false,\n  stream: false,\n  check: fase\n}\n```\n\ndaemonize is a flag to use one instance of the clamav instead of\nthe creation of new instances for each request.\n\n```elixir\niex\u003e Clamxir.safe?(%Clamxir{}, \"/path/file\")\n```\n\nstream will pass the argument --stream to clamdscan, this will help\nto avoid permission issues. \n\n```elixir\niex\u003e Clamxir.safe?(%Clamxir{stream: true}, \"/path/file\")\n```\n\ncheck flag will add validation of the scanner availability before try\nto run it.\n\n```elixir\niex\u003e Clamxir.safe?(%Clamxir{check: true}, \"/path/file\")\n```\n\n## Integration with Phoenix\n\n1.  Install as dependency\n    mix.exs\n\n```elixir\n{:clamxir, \"~\u003e 0.1.8\"}\n```\n    \n2.  Use in the controller action where the files are uploaded\n\n```elixir\ndef upload(conn, params) do\n  file = params[\"index\"][\"file\"]\n  # Requires to have clamavdscann to work\n  case Clamxir.safe?(%Clamxir{daemonize: true}, file.path) do\n    true -\u003e\n      # Process the file and ...\n      conn\n      |\u003e put_flash(:info,  \"Created successfully\")\n      |\u003e redirect(to: \"/\")\n    false -\u003e conn\n      |\u003e put_flash(:error,  \"Virus!!\")\n     |\u003e redirect(to: \"/\")\n  end\nend\n```\n    \nFor a working sample please refer to:\n[https://github.com/ramortegui/sample_phoenix_clamxir](https://github.com/ramortegui/sample_phoenix_clamxir)\n\nDocs can be found at [https://hexdocs.pm/clamxir](https://hexdocs.pm/clamxir).\n\n\n## TODO\n- Add Logger features\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Framortegui%2Fclamxir","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Framortegui%2Fclamxir","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Framortegui%2Fclamxir/lists"}