whatzapper 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +22 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +24 -0
- data/Rakefile +2 -0
- data/bin/whatzapper +11 -0
- data/lib/whatzapper/version.rb +3 -0
- data/lib/whatzapper/zapper.rb +68 -0
- data/lib/whatzapper.rb +8 -0
- data/whatzapper.gemspec +24 -0
- metadata +97 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e05deb78a0579ffaf61eafbf1d47de5afb92251f
|
4
|
+
data.tar.gz: b8bad84f0c1f4d37dde2bb911b8f2917c69578b6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a6d05fe7c27350cd95592ab0a3ce64a0fe34ccd5e116e481f73b2ef9058922666245b60966411d94cdfba6a0a4404471441a72c33fdd074e357d9811e0a768ae
|
7
|
+
data.tar.gz: 0af07fbddee5d9d9a6e1a93a26f2b5ed1bf16fd67149ed06c057039845d4d68e1245b4c498e19e14ecf673bd4f61f54b712ecce4e1fcf40ee4db3ced4f1501b0
|
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Armand du Plessis
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# Whatzapper
|
2
|
+
|
3
|
+
Quick gem to sort out the Whatsapp database for text causing crashes on iOS8 Beta 1/2.
|
4
|
+
Whatsapp for some reason (would be quite interesting to know why) crashes when receiving certain character strings, if|fi|ff. (http://www.reddit.com/r/iOS8/comments/28e3ub/beta_2_whatsapp_fix/)
|
5
|
+
|
6
|
+
DISCLAIMER: Unless you specify a path to Chatstorage.sqlite that's not mounted on your phone you may kill your database. Which if you are trying this would probably already be unusable so much of a muchness.
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
$ gem install whatzapper
|
11
|
+
|
12
|
+
## Usage
|
13
|
+
|
14
|
+
* Install iExplorer from http://www.macroplant.com/iexplorer/
|
15
|
+
* Mount your WhatsApp/Documents directory
|
16
|
+
* bundle exec whatzapper full_path_to_/ChatStorage.sqlite
|
17
|
+
|
18
|
+
## Contributing
|
19
|
+
|
20
|
+
1. Fork it ( https://github.com/[my-github-username]/whatzapper/fork )
|
21
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
22
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
23
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
24
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bin/whatzapper
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'sqlite3'
|
2
|
+
require 'tmpdir'
|
3
|
+
|
4
|
+
module Whatzapper
|
5
|
+
class Zapper
|
6
|
+
|
7
|
+
WTFS = /(fi|if|ff|fl)/
|
8
|
+
|
9
|
+
attr_accessor :path
|
10
|
+
|
11
|
+
def initialize(path)
|
12
|
+
@path = Pathname.new path
|
13
|
+
end
|
14
|
+
|
15
|
+
def clean_db
|
16
|
+
work_in_writable_space do |working_db|
|
17
|
+
zap(working_db)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
protected
|
22
|
+
def zap(path)
|
23
|
+
open_db(path) do |db|
|
24
|
+
open_chats(db) do |message|
|
25
|
+
pk, text = message['Z_PK'], message['ZTEXT']
|
26
|
+
puts "reading #{text}"
|
27
|
+
next unless text =~ WTFS
|
28
|
+
puts "culprit: #{text}"
|
29
|
+
clean_message(db, pk, text)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
def open_db(path)
|
36
|
+
SQLite3::Database.new(path) do |db|
|
37
|
+
puts "Database.readonly? #{db.readonly?}"
|
38
|
+
yield db
|
39
|
+
puts "Total Changed: #{db.total_changes}"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def open_chats(db)
|
44
|
+
stmnt = db.prepare("select * from ZWAMESSAGE")
|
45
|
+
stmnt.execute.each_hash do |row|
|
46
|
+
yield row
|
47
|
+
end
|
48
|
+
stmnt.close
|
49
|
+
end
|
50
|
+
|
51
|
+
def work_in_writable_space
|
52
|
+
Dir.mktmpdir do |tmp_dir|
|
53
|
+
FileUtils.cp self.path.realpath, tmp_dir
|
54
|
+
working_db = (Pathname.new(tmp_dir) + self.path.basename).to_s
|
55
|
+
yield working_db
|
56
|
+
FileUtils.cp working_db, self.path
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def clean_message(db, pk, text)
|
61
|
+
cleaned_text = text.sub(WTFS) do |match|
|
62
|
+
"#{match[0]}*"
|
63
|
+
end
|
64
|
+
puts "cleaned: #{cleaned_text}"
|
65
|
+
puts db.execute("UPDATE ZWAMESSAGE SET ZTEXT = ? WHERE Z_PK = ?;", cleaned_text, pk)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
data/lib/whatzapper.rb
ADDED
data/whatzapper.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'whatzapper/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "whatzapper"
|
8
|
+
spec.version = Whatzapper::VERSION
|
9
|
+
spec.authors = ["Armand du Plessis"]
|
10
|
+
spec.email = ["adp@bank.io"]
|
11
|
+
spec.summary = %q{Cleans out crashing patterns in Whatsapp database for iOS8 Beta}
|
12
|
+
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_dependency "sqlite3"
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: whatzapper
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Armand du Plessis
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-07-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.6'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: sqlite3
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description:
|
56
|
+
email:
|
57
|
+
- adp@bank.io
|
58
|
+
executables:
|
59
|
+
- whatzapper
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- ".gitignore"
|
64
|
+
- Gemfile
|
65
|
+
- LICENSE.txt
|
66
|
+
- README.md
|
67
|
+
- Rakefile
|
68
|
+
- bin/whatzapper
|
69
|
+
- lib/whatzapper.rb
|
70
|
+
- lib/whatzapper/version.rb
|
71
|
+
- lib/whatzapper/zapper.rb
|
72
|
+
- whatzapper.gemspec
|
73
|
+
homepage: ''
|
74
|
+
licenses:
|
75
|
+
- MIT
|
76
|
+
metadata: {}
|
77
|
+
post_install_message:
|
78
|
+
rdoc_options: []
|
79
|
+
require_paths:
|
80
|
+
- lib
|
81
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
requirements: []
|
92
|
+
rubyforge_project:
|
93
|
+
rubygems_version: 2.2.2
|
94
|
+
signing_key:
|
95
|
+
specification_version: 4
|
96
|
+
summary: Cleans out crashing patterns in Whatsapp database for iOS8 Beta
|
97
|
+
test_files: []
|