{"id":34017926,"url":"https://github.com/mahdikhoshdel/accesswatch","last_synced_at":"2026-05-01T22:33:55.212Z","repository":{"id":254354583,"uuid":"846287131","full_name":"mahdikhoshdel/accesswatch","owner":"mahdikhoshdel","description":"A tool that retrieves and displays file or directory access information In Linux and Windows","archived":false,"fork":false,"pushed_at":"2024-10-05T17:34:21.000Z","size":42,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-15T03:40:48.510Z","etag":null,"topics":["access","gid","linux","python","python3","security","security-tools","ssid","uid","windows"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mahdikhoshdel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-08-22T22:35:11.000Z","updated_at":"2025-08-09T17:22:25.000Z","dependencies_parsed_at":"2024-09-02T16:41:36.441Z","dependency_job_id":"05e489a1-2a1f-407f-bc1e-5bf2e8b43c13","html_url":"https://github.com/mahdikhoshdel/accesswatch","commit_stats":null,"previous_names":["mahdikhoshdel/windows-file-access","mahdikhoshdel/access-watch","mahdikhoshdel/accesswatch"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mahdikhoshdel/accesswatch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahdikhoshdel%2Faccesswatch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahdikhoshdel%2Faccesswatch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahdikhoshdel%2Faccesswatch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahdikhoshdel%2Faccesswatch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mahdikhoshdel","download_url":"https://codeload.github.com/mahdikhoshdel/accesswatch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahdikhoshdel%2Faccesswatch/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32515838,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["access","gid","linux","python","python3","security","security-tools","ssid","uid","windows"],"created_at":"2025-12-13T14:52:10.573Z","updated_at":"2026-05-01T22:33:55.192Z","avatar_url":"https://github.com/mahdikhoshdel.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Access Watch\n![Python](https://img.shields.io/badge/Python-3.6%2B-blue) ![License](https://img.shields.io/badge/License-MIT-yellow) ![Platform](https://img.shields.io/badge/Platform-Linux%20%7C%20Windows-brightgreen)\n\n**Access Watch** is a Python script designed to retrieve and display file access information, such as last access time and file ownership details, on both Linux and Windows systems. The script utilizes OS-specific modules to gather this information, making it versatile and suitable for cross-platform environments.\n\n\n## 🚀 Features\n\n- 🔍 Retrieve and display the last access time of a file.\n- 👤 Display the file owner's user ID and group ID\n- 🔄 Convert user ID to username and group ID to group name.\n- 🖥️ Cross-platform support: Works on both Linux and Windows.\n\n\n## 🐧 LinuxAccessWatch  \n\nThe `LinuxAccessWatch` class is designed to monitor and retrieve file information related to user access in a Linux environment. It provides methods to obtain metadata such as the last access time, owner UID, owner GID, owner username, and owner group name of a specified file or directory.  \n\n#### Methods  \n\n- **`get_file_stats() -\u003e None`**: Gathers file statistics including last access time, owner UID, and owner GID.  \n- **`get_owner_uid() -\u003e Optional[int]`**: Retrieves the user ID (UID) of the file owner.  \n- **`get_owner_gid() -\u003e Optional[int]`**: Retrieves the group ID (GID) of the file owner.  \n- **`uid_to_username() -\u003e str`**: Converts the owner UID to a human-readable username.  \n- **`gid_to_groupname() -\u003e str`**: Converts the owner GID to a human-readable group name.  \n- **`get_last_access_time() -\u003e Optional[str]`**: Returns the last access time of the file in a human-readable format.\n- **`get_username() -\u003e str`**: Retrieves the username of the file owner.  \n- **`get_groupname() -\u003e str`**: Retrieves the group name of the file owner.  \n \n\n#### Usage  \n\n```python\nfrom accesswatch.linux import LinuxAccessWatch\n\naccess_watch = LinuxAccessWatch(\"/path/to/file_or/directory\")\nlast_access_time = access_watch.get_last_access_time()\n# Sat Sep 21 10:48:05 2024\nowner_uid = access_watch.get_owner_uid()\n# id\nowner_gid = access_watch.get_owner_gid()\n# id\nusername = access_watch.get_username()\n# username\ngroupname = access_watch.get_groupname()\n# usergroup\n```\n\n## 🪟 WindowsAccessWatch\n`WindowsAccessWatch` is a class designed to monitor and retrieve information about file access on Windows systems. It tracks the last access time of a file, retrieves the owner Security Identifier (SID), and converts this SID into a human-readable account name, domain name, and account type.\n\n\n#### Methods\n- **`__init__(file_path)`**: Initializes the `WindowsAccessWatch` object with the file path and retrieves the owner SID.\n- **`set_owner_sid()`**: Sets the owner SID for the specified file or directory.\n- **`get_file_stats()`**: Retrieves the last access time and owner SID of the file.\n- **`get_last_access_time()`**: Returns the last access time in a human-readable format.\n- **`get_owner_sid()`**: Returns the owner SID of the file.\n- **`get_owner_sid_string()`**: Returns the owner SID as a string in a human-readable format.\n- **`sid_to_username_info(sid)`**: Converts a given SID to a username, domain name, and account type.\n- **`user_access_info()`**: Retrieves the account name, domain name, and account type for the file owner.\n\n#### Usage\n\n```python\nfrom accesswatch.windows import WindowsAccessWatch\n\naccess_watcher = WindowsAccessWatch(\"/path/to/file_or/directory\")\nlast_access_time = access_watcher.get_last_access_time()        \nowner_sid = access_watcher.get_owner_sid_string()\naccount_name, domain_name, account_type = access_watcher.user_access_info() \n```\n\n\n## 🤝 Contributing\n\nContributions are welcome!\n\nGithub:  https://github.com/mahdikhoshdel/accesswatch.git\n\nPlease follow these steps:\n1. Fork the repository.\n2. Create a new branch (`git checkout -b feature-branch`).\n3. Make your changes.\n4. Commit your changes (`git commit -m 'Add some feature'`).\n5. Push to the branch (`git push origin feature-branch`).\n6. Open a pull request.\n\n## License\n\nThis project is licensed under the MIT License.\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmahdikhoshdel%2Faccesswatch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmahdikhoshdel%2Faccesswatch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmahdikhoshdel%2Faccesswatch/lists"}